How can I input a file in my program so that at the beginning his information will be put out on the screen??
How can I input a file in my program so that at the beginning his information will be put out on the screen??
That's the most basic way I know...it's in C++.Code:#include <fstream> #include <string> #include <iostream> using namespace std; int main(void) { string input; ifstream in("c:\\new.txt"); while(!in.eof()) { getline(in, input, (char)EOF); cout<<input; } return 0; }
Be more specific and I can tell you want you want to hear
Last edited by -KEN-; 01-18-2003 at 04:09 PM.
yes but this doesn't work under win32 API
It really does, though...that's the beautiful thing about it.
look, I'll compile it on MSVC++ and stick it into a windows app rrrriiiiigggghhhhtttt.....now! ::clicky:: "Compiling..." - look at that, no errors. ::runs program:: and hey, look at that! It runs!
Sure, there are specific functions you can use for WinAPI file I/O, but they're not particularly neccesary.
Of course, that was just an example to show you the file I/O aspect of it. The cout and main() won't compile in a windows program, if that's what you meant.