Hi guys,
I'm having problems with reading the first line in a certain text file. I use the following function to do this:
Code:
fpin = fopen(id_index, "rb");
while((ih=fgetc(fpin))!=EOF)
{
while(fgets(buf,BUFSIZ,fpin)!=NULL)
{
strcpy(id_array[cnt],buf);
cnt++; // count the amount of identifier files found
}
}
fclose(fpin);
This is what the text file (id_index) looks like:
840.txt
1224.txt
1293.txt
520.txt
909.txt
1101.txt
1042.txt
1160.txt
1294.txt
1928.txt
1938.txt
1933.txt
2018.txt
1900.txt
1899.txt
Now when I save those names, line by line into an array, the first value of the array is:
So it misses the first character! Any idea how I can solve this problem?
Thanks in advance for any help!
René