Hi,
My csv file is formatted as such:
<----------------------->
AID,partNumber,HardwareRevision
NHFH0A0165002050603333,68-0165-002,A
<----------------------->
I can read the first line in fine and split the csv string, but I am unable to read in the second third line (second line is blank space). I have tried "While (!feof(fptr))" with no luck, goes into a continious loop and still only reads the first line.
Any help would be greatly appreciated. Thanks.
Chaz Byrne
My current code:
<----------------------->
#include <formatio.h>
#include <userint.h>
#include <ansi_c.h>
int main()
{
FILE *fptr; //file pointer
char string[2000];
char item1[50];
char item2[50];
char item3[50];
if ( (fptr = fopen( "C:\\AID.csv", "rt"))==NULL )
{
printf("Warning: Problem opening file or file not found\n");
return -1;
}
fscanf(fptr, "%s", string);
//while (feof( fptr)==0)
//{
Scan (string, "%s[xt44]%s[xt44]%s[xt44]", item1,item2,item3);
printf("%s\n%s\n%s\n%s\n\n",string,item1,item2,item3);
//}
fclose( fptr );
MessagePopup ( "Just to hold it...","Testing");
return 0;
}
<----------------------->
Output:
<----------------------->
AID,partNumber,HardwareRevision
AID
partNumber
HardwareRevision
<----------------------->