lets say i write a block of text in a notpad file, multiple otepad files, is there a way i make my program open it and import the text.. or is it better to just put the text directly in the code???
Printable View
lets say i write a block of text in a notpad file, multiple otepad files, is there a way i make my program open it and import the text.. or is it better to just put the text directly in the code???
If you are under windows and don't care much about portability you can use CreateFile(), GetFileSize() and ReadFile(). This will get you the whole text, given that you have access to enough memory to buffer the text. If you care about portability, you can use an std::ifstream object.
Edit: I was slightly off-topic. Putting the text in your code will only make your code harder to read and longer uselessly. If you have a lot of text to load and it is causing your application to slow down when loading text, you can create a separate thread to load the text.
Or you could go with the completely crazy idea and learn File I/O. There are even tutorials on the site, I hear.