Thread: copying contents of text file defined at runtime into an array

  1. #16
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by sagar474 View Post
    Stream I/O is BUFFERED: That is to say a fixed ``chunk'' is read from or written to a file via some temporary storage area (the buffer). NOTE the file pointer actually points to this buffer.
    Ummmm... no... the file pointer is the next position in the disk file... if it pointed at the buffer fseek() would be useless.

    The first time you have to seek to position 8,000,000,000 on a system with 2gigs of ram, you'll understand that.

    if you really need to read directly form disk you can use Low Level I/O.
    Most OSs will no longer permit low level disk I/O at the application level and for the most part it's downright silly to try to bypass the OS safeguards... one bad call and you end up reformatting your disks and reinstalling everything... NOT an acceptable risk.

  2. #17
    Registered User sagar474's Avatar
    Join Date
    Jun 2011
    Location
    Kakinada
    Posts
    56
    Ummmm... no... the file pointer is the next position in the disk file... if it pointed at the buffer fseek() would be useless.

    The first time you have to seek to position 8,000,000,000 on a system with 2gigs of ram, you'll understand that.
    hence fixed ``chunk'' is read.

    Most OSs will no longer permit low level disk I/O at the application level and for the most part it's downright silly to try to bypass the OS safeguards... one bad call and you end up reformatting your disks and reinstalling everything... NOT an acceptable risk.

    Help - IBM Mac OS X Compilers
    read the line in the above link.
    Use the low-level I/O functions, such as open and close. These functions are faster and more specific to the application than the stream I/O functions like fopen and fclose. You must provide your own buffering for the low-level functions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing contents of a text file
    By never_lose in forum C Programming
    Replies: 10
    Last Post: 04-28-2011, 09:25 AM
  2. pass contents of text file to 2d array
    By darksifer in forum C Programming
    Replies: 0
    Last Post: 11-22-2010, 12:45 PM
  3. need to read a User defined file during runtime
    By john_newbie in forum C Programming
    Replies: 8
    Last Post: 03-06-2004, 02:08 AM
  4. displaying contents of a text file
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 02-26-2002, 02:05 PM