Here is my file text file data
Tree Bush
Apple Mango
Animal Dog
Animal2 Cat
#include <stdio.h>
#include<conio.h>
#include<string>
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
FILE * pFile;
char mystring [100];
char mystring2[100];
char ch;
int i=0,j=0;
pFile = fopen ("c:\\List.txt" , "r");
if (pFile == NULL) perror ("Error opening file");
else
{
while(!feof(pFile))
{
while(getc(pFile)!=' ');
{
fgets (mystring , 20 , pFile);
printf("\n");
puts (mystring);
}
}
}
fclose (pFile);
getch();
}
i get output
Bush
Mango
Dog
Cat
i m not getting 1st string in line ..
that means --->Tree
Apple
Animal
Animal2
how to get this string??
i want each string individually ??how to get this??