Loading yet another structure

This is a discussion on Loading yet another structure within the C Programming forums, part of the General Programming Boards category; I am trying to load a structure from a file called "class.dat" The incoming data is delimited by the pipe ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    37

    Loading yet another structure

    I am trying to load a structure from a file called "class.dat"

    The incoming data is delimited by the pipe | key. The biggest problem is the name field is not a fixed width. Here is a sample of how the data looks in the file.

    001635223|Stevens, Bill R.|COSC1400| |004760097|Smith, William O.|COSC1401| |006238033|Smithson, Thelma R.|ITSC1401| |010354130|Woodsen, Richard U.|ITSC1401| |014831430|Adams, Francis H.|COSC1403| |020349068|Adams, John M.|ITSC1401| |023939684|Woodsen, Carla R.|ITSC1403| |


    I get the following 2 errors and 1 warning whe trying to run the program.

    3a.test.c
    d:\3a_test\3a.test.c(92) : error C2223: left of '->_cnt' must point to struct/union
    d:\3a_test\3a.test.c(92) : error C2223: left of '->_ptr' must point to struct/union
    d:\3a_test\3a.test.c(92) : warning C4133: 'function' : incompatible types - from 'char [51]' to 'struct _iobuf *'
    Error executing cl.exe.

    3a.test.exe - 2 error(s), 1 warning(s)

    Ultimately once the structure is loaded, I will search the structure for a certain class number IE: COSC1401, and send the name, SSN, and reserved space to a report. The code is attached below.

    As always,
    any help is greatly appreciated,
    Alan
    Attached Files Attached Files

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > void main(struct student *s, int n)

    Um... no.

    1) 'main' returns an integer, not 'void'(nothing).
    2) How exactly are you calling main so that it understands these arguments?
    3) You use exit(), and yet, you have 'void main'. Wrong.

    > \3a_test\3a.test.c(92) : error C2223: left of '->_cnt' must point
    > to struct/union

    You access a structure directly with "." and with a pointer via "->".
    As such, since you have such a fubar 'main' declaration, then we
    can definately state that 's' is a pointer. Therefore, you must use
    "->" to access its members.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. Loading file into structure
    By Spitball in forum C++ Programming
    Replies: 5
    Last Post: 08-14-2004, 09:38 AM
  3. problem printing out structure after loading
    By pari in forum C Programming
    Replies: 17
    Last Post: 11-23-2002, 08:12 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM
  5. C structure within structure problem, need help
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 11-30-2001, 04:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21