Hi, been searching but can't find anything... no idea what search parameters to use, so excuse me if this has already been discussed somewhere!
I've got the following problem: I have a file that contains the following (example) data:
Manufacturer;Model;2007;Signal_Name;640;2;0;Tester ;0
Another_Manufacturer;Some_Model;2007;Signal2_Name; 756;4;0;Some_Tester;0
etc.
As you can see it's a ;-seperated file that contains signal information. Every new line in the file represents a new signal.
The final '0' on the line indicates the signal isn't processed yet (i.e. added to our signal database).
Now, what I need to do is, when the signal has been processed, replace that '0' with a '1'. I think this should be doable with pointers, but apparently I have too little knowledge about pointers to make this work.
Here's an example of what I thought is a solution - please note I know this example is 90% bollocks, it's a "road plan" rather than a code example:
Code:
FILE *fpin;
int signals_cnt=0;
if((fpin = fopen(signal_file,"r+"))!=NULL)
{
while(fpin!=EOF)
{
fpin++;
puts(fpin);
if(fpin=='\n')
{
signals_cnt++;
if(signals_cnt==processed_signal_number)
{
fpin--;
fpin='1';
}
}
} // while(fpin!=EOF)
}
So the idea is to check for a new line character to count the signal number, and when the desired signal number was found, change the 0 into 1.
Apparantly fpin (declared as a FILE type) doesn't like being played with (the fpin++ results in blabla on-screen).
Hope it's clear :S Any help would be greatly appreciated!
Thanks in advance, René