S
- Steve -
I've been given a school assignment and while everything else is easy
there's one topic I'm completley lost on.
I've been given an ASCII file that looks like this. During start-up, the
program needs to read an ASCII data file of inventory records and build an
appropriate dynamic data structure using structs and pointers.
10112 MICROPROCESSOR 2100 2 B 000008.50 000012.50
10235 CHARACTER_PRINTER 4013 4 C 000995.00 001295.00
10450 FLOPPY_DISK_DRIVE 6023 6 B 000650.00 000885.00
10683 VIDEO_DISPLAY_TERMIN 5000 5 C 000550.00 000750.00
The format is:
5 digits Item Number
space
20 chars Item description
space
4 digits Quantity
space
1 digit Category code
space
........ and so on.
What should my strucutre look like? I was thinking I could just use an
array of length 55 or so. But that doesn't seem to fit the requirment for a
strucutre. Why not just have a two dimensional array then. The strucutre
could have variable for each item (Item Number, Item Description, etc), but
how can I parse the file correctly then?
there's one topic I'm completley lost on.
I've been given an ASCII file that looks like this. During start-up, the
program needs to read an ASCII data file of inventory records and build an
appropriate dynamic data structure using structs and pointers.
10112 MICROPROCESSOR 2100 2 B 000008.50 000012.50
10235 CHARACTER_PRINTER 4013 4 C 000995.00 001295.00
10450 FLOPPY_DISK_DRIVE 6023 6 B 000650.00 000885.00
10683 VIDEO_DISPLAY_TERMIN 5000 5 C 000550.00 000750.00
The format is:
5 digits Item Number
space
20 chars Item description
space
4 digits Quantity
space
1 digit Category code
space
........ and so on.
What should my strucutre look like? I was thinking I could just use an
array of length 55 or so. But that doesn't seem to fit the requirment for a
strucutre. Why not just have a two dimensional array then. The strucutre
could have variable for each item (Item Number, Item Description, etc), but
how can I parse the file correctly then?