ow can i use fgets to read and ignore the first two lines of a file and output into another file
- From: "Justme" <heylove2085@xxxxxxxxx>
- Date: 30 Sep 2006 13:32:52 -0700
Novice programmer needs help with using fgets to read and ignore the
first two lines of a file. I've gone thru the previous posting
regarding fgets, but none of them seems to help my situation.
I have airdata file that i have to read, but in other teh fscanf to
work properly, i need to ignore the first two lines, because scanf does
not read spaces.
This is what my current code looks like
#include <stdio.h>
#include <sting.h>
#include <stdlib.h>
int main()
{
FILE * AirFile; //the file that contains the data to be read
FILE *textFile; //the out file for both lines
char text1[1000];
char text2[100]
if (AirFille == NULL || textFile)
{
printf("Failed to open file \n")
return -1;
else if ( text1[0] =='\n')
{ fgets(text1, 1000, AirFile);
fprintf(textFile, "allocating:", AirFile);
}
}
fclose(textFile);
fclose(AirFile)'
retrun 0;
}
.
- Follow-Ups:
- Re: ow can i use fgets to read and ignore the first two lines of a file and output into another file
- From: Michal Nazarewicz
- Re: ow can i use fgets to read and ignore the first two lines of a file and output into another file
- From: pete
- Re: ow can i use fgets to read and ignore the first two lines of a file and output into another file
- From: Eric Sosman
- Re: ow can i use fgets to read and ignore the first two lines of a file and output into another file
- Prev by Date: Re: Working with files and directories on Windows
- Next by Date: Re: C related, but not a C question..
- Previous by thread: rolling dice
- Next by thread: Re: ow can i use fgets to read and ignore the first two lines of a file and output into another file
- Index(es):
Relevant Pages
|
|