Thread: Can anyone help me with this code please

  1. #1
    Registered User
    Join Date
    Feb 2002

    Question Can anyone help me with this code please

    These are my structures and when i try to access them i get an error message that says 'structure required on left side of . or .* in function main. I have put the code below the structures any help would be much appreciated
    typedef struct {

    char part_num[7];
    int quantity;
    } I_R_details;

    typedef struct {

    char cust_name[21];
    char cust_addr[61];
    float cust_bal;
    long credit_limit;
    } creation_details;

    typedef struct
    char record_type;
    char cust_code[7];
    I_R_details irInfo;
    creation_details cInfo;
    } unval;


    if(unval.I_R_details.record_type == 'I' )

    I want to see if the first letter in the record is an I then i do some code which is ok but unsure about this line though

    many thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    You're using structure member type names, not member names

    customer foo;
    if ( foo.record_type == 'I' )

    foo.unval.irInfo.quantity = 1234;

  3. #3
    Registered User
    Join Date
    Aug 2001
    sent a message....fellow computeach here.

    infile is text....
    outfile can be either text or binary...

    main loop.. read file record at a time.
    this can be acheived by either by
    getting the full string upto the '\n' character
    then find the length of the string to determin the type of record
    then disect the string according to the file/record structure in your project specification.
    get first character on each line of text file...which would be record type...then get remainder of the record.

    All will become clearer at dudley.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM