how to read a txt file with C++ in linux and output it?
Hi guys
i'm really new to this stuff. i have wrote a long piece of code above with the "main" which is calling openFile( &fout, filename ) filename contains the txt name in a form of "data.txt" i wanna read the data from the file and output it into fout for later use. the data in that file is a vector looking interger group. i have the following code: int openFile( ofstream * fout, const char * filename) { ifstream iFile(filename); iFile >> &fout; return 0; } when i make it, the following error messagge shows up: 315P3.cpp: In function ‘int openFile(std::ofstream*, const char*)’: 315P3.cpp:52: error: no match for ‘operator>>’ in ‘iFile >> & fout’ how can i fix this problem? thank you~! |
Quote:
Also, regarding C++ and the two operators - do the operators have just one meaning or may have more than one meaning ? Hint: have you ever heard of operator overloading in C++ ? |
All times are GMT -5. The time now is 10:04 PM. |