1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

i wnat to wonder around a file of 10^29 character ....... in any way...

Discussion in 'C' started by savalia jay, Aug 24, 2010.

  1. savalia jay

    savalia jay New Member

    Joined:
    Aug 24, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i know one function that is fseek but its second argument is long so we cant use.....bcz file has 10^28 character and is outside the range of long.........

    can any one help...me...
     
  2. savalia jay

    savalia jay New Member

    Joined:
    Aug 24, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    i know one function that is fseek but its second argument is long so we cant use.....bcz file has 10^29 character and is outside the range of long.........

    can any one help...me...
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    You'll have to look in your platform-specific documentation. As you have discovered, the C standard library doesn't cover such large numbers. There might be a large file platform-specific (i.e. non-standard) extension to the FILE stuff, or it could be reimplemented in a different library.

    Another approach could be to use redirection, e.g.:
    cat bigfile | myprog

    then in myprog just do
    Code:
    while ((c=getchar())!=EOF)
    {
     // ...
    }
    
    although that is one-way wandering, not random access.
     
  4. savalia jay

    savalia jay New Member

    Joined:
    Aug 24, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    but i want to move around file....
    means currently pointer is at 10^27 now i want to read a character which at 10^19 how can i do............?
     
  5. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Yes, that's why I said "You'll have to look in your platform-specific documentation".

    I can't do that because you've given no clues as to what your platform is, other than that it's an OS with a filesystem that caters for single file sizes up to at least 100,000 Yottabytes (Yotta=1,000,000 Exa; Exa=1,000,000 Tera; Tera=1,000,000 Mega).
     

Share This Page