Thread: Reading Files in C

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    1

    Reading Files in C

    I was once a Computer Science major (12 years ago), then switched to Meteorology before forgetting everything I'd learned about programming.

    SO... now I'm working on my master's thesis and have found that I need to write some code. Yay. Basically, I need to open a file (may be variable in size) of weather information and import those data (10 columns across and many, many lines(rows) long) into an array for comparison with another array that needs to be created in a similar manner.

    One issue is that the array will have to be variable in size to accommodate variable datafile sizes.

    Other issue is I have no idea how to open the files and read them.

    How can this be done in C? I could use MATLAB, I suppose, but would rather use C if I can.

    Thank you,

    Mike

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    You could start with the FAQ on reading files.

    ~/

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    With the variable length data files you'll probably need to do some reading on dynamic memory allocation as well.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading User Defined Files
    By Necrofear in forum C++ Programming
    Replies: 17
    Last Post: 06-30-2006, 12:55 AM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  3. reading files
    By hiya in forum C++ Programming
    Replies: 7
    Last Post: 05-21-2005, 11:40 AM
  4. A little help reading from files...
    By Invincible in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2002, 10:43 AM
  5. Need Advice in reading files
    By jon in forum C Programming
    Replies: 4
    Last Post: 10-07-2001, 07:27 AM