How to skip the first line when fscanning a .txt file?

Fgets will get one line, and set the file pointer starting at the next line. Then, you can start reading what you wish after that first line.

Fgets will get one line, and set the file pointer starting at the next line. Then, you can start reading what you wish after that first line. Char buffer100 fgets(buffer, 100, pointer); It works as long as your first line is less than 100 characters long.

Otherwise, you must check and loop.

Thanks this works perfectly! – Fendi May 10 '10 at 0:12.

It's not clear what are you trying to store your data into so it's not easy to guess an answer, by the way you could just skip bytes until you go over a \n: FILE *in = fopen("file. Txt","rb"); Then you can either skip a whole line with fgets but it is unsafe (because you will need to estimate the length of the line a priori), otherwise use fgetc: uchar8 c; do c = fgetc(in); while (c! = '\n') Finally you should have format specifiers inside your fscanf to actually parse data, like fscanf(in, "%f", floatVariable); you can refer here for specifiers.

Thanks for the reply, I tried using "rb" but that didn't work :( Thank you for the link to specifiers, im checking them now. – Fendi May 10 '10 at 0:13 1 It shouldn't be "rb" but just "r". – Casey May 10 '10 at 0:38 cplusplus.Com/reference/clibrary/cstdio/fopen – Casey May 10 '10 at 0:38.

Fgets would work here. #define MAX_LINE_LENGTH 80 char bufMAX_LINE_LENGTH; /* skip the first line (pFile is the pointer to your file handle): */ fgets(buf, MAX_LINE_LENGTH, pFile); /* now you can read the rest of your formatted lines.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions