Sunday, May 10, 2009

C++ fstream help?

Hey guys I need some different help now. When I take data from a text file, how can I dynamically bring it in as like a cstring for easy manipulation? or if thats too much to ask, how can I bring it in for manipulation when the number of items in the file isn't predefined.





Also, how can I have a user give the text file name through cin or an equivalent? I've tried just inputing a string and opening it but i get errors....

C++ fstream help?
CString...I think thats Visual C++'s class for strings?





If its a text file, you just read the data according to whatever format it's stored in. Likewise for binary (usually by records)





Inputing a filename via cin should work





char fileToOpen[256] ;


cin %26gt;%26gt; fileToOpen ;


istream input( fileToOpen ) ;


// .. etc ..

edible flowers

No comments:

Post a Comment