OK I decided to use the third option.
1 2 3 4 5 6
|
while ((fscanf(fr,"%[^;];%[^;];%[^;];%[^;];%[^;];%s",&material,&depth,&l,&w,&q,&code))!=EOF)
{
printf("%s %s %s %s %s %s",material,depth,l,w,q,code); //console preview
fprintf(fw,"%s %s %s %s %s %s",material,depth,l,w,q,code);
}
|
The input file ends with a empty line.
For the following input 3 lines(2 records and an empty(new) line):
Oak;18,00;542,00;362,00;1;K_RAFI
Oak;18,00;364,00;100,00;1;CR Front
I get an output like this:
Oak 18,00 542,00 362,00 1 K_RAFI
Oak 18,00 364,00 100,00 1 CR Front
18,00 364,00 100,00 1 CR
I get the last line one more time but without the material variable.
If I delete the last empty line in the input file the output is the one that I want...
Oak 18,00 542,00 362,00 1 K_RAFI
Oak 18,00 364,00 100,00 1 CR Front