Reading files in C

Discussion in 'Web Design & Coding' started by zyfos, Mar 17, 2003.

  1. zyfos

    zyfos Resurrected

    Messages:
    236
    I'm trying to write a program in C (not C++) that reads a wtmpx file (holds data on when users logon/off a unix machine). Anyway, I have a struct that has all the variables that I need to read in from the file. The file's contents are based off this struct. Some of the variables are character strings of a fixed size. I need to know how I can read in an entire struct worth of data from the file using fscanf() instead of read(). Any help would be much appreciated.


    http://www.noserose.net/e/code/utxreader.c
    The struct I'm using is at the bottom of that page.
     
  2. zyfos

    zyfos Resurrected

    Messages:
    236
    Nevermind, figured it out. (I hate C.)