I want to load an array of strings with data read from a file but the methods I am used to from other languages just don't work in C/C++. Please could someone explain my misunderstandings and show me what to do.
Here's an extract of what I've got:
char* get_csvstring(char* instring, char* outstring);
//Open plot file
if((fptr = fopen("\\\\My Documents\\\\JI-gnd-plots.csv","r")) != NULL)
k = 0;
tp = get_csvstring(Buffer,temp);
PlotID[k] = temp;
The function get_csvstring collects the first 9 characters of Buffer and returns them as temp. The routine runs, but contrary to my original expectations, all elements of the array PlotID end up taking the same value, the last encountered. I think I understand now why this is so, but my real question is how can I acquire an array of different string values from the data file? I have tried many variations on the above without success.
With many thanks in advance for any help or suggestions,