Re: [Dev-C++] Reading from text file
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2005-07-09 10:19:32
|
Ever heard anyone say that constant numbers within the code is bad? char* inLine = new char[900]; ... openTextFile.getline(inLine,9000); How do you expect 9000 characters to fit into a 900 char buffer? And more - how to you expect to have the extra room to possibly concatenate "\r\n" to the end of the line? By the way, why do you mix C and C++ code? Why not use the std::string class? /Per W On Fri, 8 Jul 2005, Noorez Kassam wrote: > I am having trouble with reading from a text file in my program. For > testing, I used notepad and typed and let word-wrap put text on the next > line. I typed a lot into this file. I then used my program to try and open > it but it froze. If I use the enter key to put in the newline then my > program works. Whats wrong with it? |