getting each word from an input

I have written code that gets full lines from a text file. Now i want to be more specific and retrieve words out of the input. I do not want any white space and i do no care about periods and hyphenated words yet.

1
2
3
4
5
6
7
8
9
10
11
12
int getLine(istream &inf, ostream &outf)
{
	char sentence[100000];
	
	while(!inf.eof())
	{
		inf.getline(sentence, 100000);
		outf << sentence << endl;
	}

	return 0;
}


Do i need to write a whole different function or can i manipulate the getLine function to get words instead. I am using C strings to do this
just use cin >> or in this case inf >>. These functions read until a whitespace is found, then stops. That way it will read each individual word.

Hope this helps
what exactly does inf >> do? if its the same as cin, then it just reads input? i dont really understand how it tells the function to stop at whitespace.
Topic archived. No new replies allowed.