| | |
Reading .txt file problem ?
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
I am trying to read lines from a .txt file and put them to a vector like this but when I run the program, the computer get stuck.
The file is only about 50 lines.
I wonder what could be wrong with this code.
The file is only about 50 lines.
I wonder what could be wrong with this code.
C++ Syntax (Toggle Plain Text)
ifstream File("C:\\Gli\\temp\\File1.txt"); std::vector<string> For; std::string Dummy; while ( File, Dummy, '\n') { For.push_back(Dummy); }
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
I just saw that I forgot getline:
C++ Syntax (Toggle Plain Text)
while ( getline(File, Dummy, '\n'))
![]() |
Similar Threads
- Reading multiple lines from a txt file (C++)
- C++ reading from .txt file and excluding punctuation! (C++)
- Setting an array and reading in a txt file backwards (C++)
- Read a web page and write the contents to a file (ASP)
- Reading and Writing file (C)
- Reading a input file (C)
- help reading from .txt file (C++)
- C++ problem... (C++)
- URGENT - Reading from txt file into a 2 dimension array (Java)
Other Threads in the C++ Forum
- Previous Thread: problem with calling a function
- Next Thread: .WAV file not playing to it's full extent...
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int integer java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





