0
{
            cout <<" file found ..." << endl;
                while((ch = infile.get()) !=' ' )
		{
		 cout <<"\nRead value is : "<< ch<<endl;
		 cout << "calling function : ";
		 populateArray(ch, i);
		 }
      }

file contents : if ( a + b ) ;

basically its taking the file pointer and taking a char, until it gets to a space. it works fine but is there anyway of telling it to carry on after the space? At the moment it gets if and then nothing else. I need it to stop at a whitespace put it into a buffer ( hence the function - for playing about with) then carrying on...

Any ideas?

cheers
John

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by WolfPack
0

Loop until you find an EOF. Something like this?

while((ch = infile.get()) != eof )
		{
                         if ( ch != space )
                         {
                		 cout <<"\nRead value is : "<< ch<<endl;
	        	         cout << "calling function : ";
	                	 populateArray(ch, i);
                          } 
		 }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.