How I can Use Malloc to Read file in Array, this is complex problem. Please help me!

Discussion in 'C Programming' started by sustle, Jan 14, 2010.

  1. sustle

    sustle

    Joined:
    Jan 14, 2010
    Messages:
    2
    Say my file have 4gb of size, and I want it to putted on Array of Unsigned Integer as binary.

    the max size C can handle array is 99999999, aproximately 99mb. I recomended by some of friends in facebook to use malloc. I search about malloc and found that malloc is used to buffering bytes in memmory (Am I wrong?)

    the question is, how I can use malloc so it can handle 4gb of files, and then write it in array? It must be on array, or something else way (if there) to evaluate its binary. How to read a file, and how to write it back to a file.

    please reply asap, i need your help guys!
    Last edited: Jan 14, 2010
    sustle, Jan 14, 2010
    #1
    1. Advertising

  2. sustle

    sustle

    Joined:
    Jan 14, 2010
    Messages:
    2
    say the code line is like this:

    int x[99999999] //it is array to handle bit to read/write file

    FILE *fileopen

    n as integer;
    open file and handle to file
    while file is open and not at End Of Line
    write it to x[n];
    n=n+1;
    end while

    but, such code can handle big file, just 99mb of file... help help, please help...
    sustle, Jan 14, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.amnet.net.au
    Replies:
    1
    Views:
    573
    =?UTF-8?b?TMSByrtpZSBUZWNoaWU=?=
    Apr 13, 2004
  2. KK
    Replies:
    2
    Views:
    552
    Big Brian
    Oct 14, 2003
  3. Eric Boutin
    Replies:
    7
    Views:
    442
  4. shadab
    Replies:
    10
    Views:
    774
    Tom St Denis
    Dec 4, 2006
  5. Gene
    Replies:
    0
    Views:
    448
Loading...

Share This Page