Pelles C forum

Pelles C => General discussions => Topic started by: Dodge on May 03, 2006, 10:46:58 PM

Title: Reading lines (content in file)
Post by: Dodge on May 03, 2006, 10:46:58 PM
Hi i have a simple code , but it doesnt work correctly:

#include <stdio.h>
main(){
char table[200];
int i;
char c;
FILE  *f;
f=fopen("TestFile.txt","r");
fscanf(f,"%i",&i);
fscanf(f,"%c",&c);
fscanf(f,"%s",&table);

while(feof(f)==0){
fgets(niz,100,f);
printf("%s\n",table);
}
fclose(f);
}

This code displais all lines in file...accept first one...it cuts the first "string" (?)
Can someone please explain to me where i go wrong? #-o
Title: Reading lines (content in file)
Post by: CLR on May 03, 2006, 11:24:18 PM
fscanf(f,"%s",&table);
Title: Reading lines (content in file)
Post by: Dodge on May 03, 2006, 11:54:01 PM
Hmm ok ... found my mistake...thnx =D>