hi all ,
i want to extract word by word in a text file to use this in other application so i wrote that code but there is some problems in the way these words apperes(ie. one line doesn't appear till it's end) and so on
the code is
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
void main ()
{
char word[15];
system ("D:\\Program Files\\Microsoft Visual Studio\\sakr.txt");
char str[100];
ifstream in("sakr.txt");
if(!in)
cout<<"not found\n";
while(in.getline(str,100))
{
int count=0;
for(int i=0;i<100;i++)
{
if (str[i]!=' ')
{
word[count]=str[i];
count++;
}
else
{
for(int k=count;k<15;k++)
word[k]=0;
count=0;
cout<<word<<endl;
}
}
}
in.close();
}
can u figure out wats wronge ..... or suggest any other solution
thanx in advance