SteeleFusion
Programmer
Hey,
I have been writing a simple program in C which uses fget to read in the first line of a text file into an array called lines[0].
The line of text is a name in the form "Bloggs, Joe" which is what is stored in the array.
However, I only really want to store the surname in the array. i.e. I would like the array to actually hold "Bloggs".
Is there a simple way to do this? I suppose its a bit like getWord (I've used it in other prog. languages.)
Is it a better approach the just read in the line in a different way, or is it easy enough to by manipulating the array itself?
(To give you a bigger idea of the program as a whole, I will be reading in other lines of the address and then adding it to a structure (record) which has 3 elements (surname, address, postcode).
Any help would be much appreciated.
CJ
I have been writing a simple program in C which uses fget to read in the first line of a text file into an array called lines[0].
The line of text is a name in the form "Bloggs, Joe" which is what is stored in the array.
However, I only really want to store the surname in the array. i.e. I would like the array to actually hold "Bloggs".
Is there a simple way to do this? I suppose its a bit like getWord (I've used it in other prog. languages.)
Is it a better approach the just read in the line in a different way, or is it easy enough to by manipulating the array itself?
(To give you a bigger idea of the program as a whole, I will be reading in other lines of the address and then adding it to a structure (record) which has 3 elements (surname, address, postcode).
Any help would be much appreciated.
CJ