Archived

This topic is now archived and is closed to further replies.

SirGorthon

Saving Stuff in a Console App

Recommended Posts

Any half-decent C++ book will cover IO streams, including file streams, which is what you want. Read about those.



Don''t listen to me. I''ve had too much coffee.

Share this post


Link to post
Share on other sites

include

using namespace std;

int main()
{
ifstream infile;
infile.open("/file.txt", ios::binary); // binary is just what i
// use, you'll be using
// ascii most likely, then
// you just dont worry
// about the second
// argument.
return 0;
}


[edit: damn tags]

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

[edited by - eldee on August 13, 2002 11:55:37 AM]

Share this post


Link to post
Share on other sites
In
ofstream a_file(filename, ios::noreplace);

it says
C:\Program Files\Microsoft Visual Studio\MyProjects\UltimateFile\UltimateFile.cpp(31) : error C2039: ''noreplace'' : is not a member of ''basic_ios >''
C:\Program Files\Microsoft Visual Studio\MyProjects\UltimateFile\UltimateFile.cpp(31) : error C2065: ''noreplace'' : undeclared identifier

but in the tutorials at cprogramming.com it says it will work.

I''m confused

Share this post


Link to post
Share on other sites
SirGorthon:

The problem is that ios::noreplace is not supported. I checked Schildt and the MSDN, and could find no reference to ios::noreplace. Removing it will stop the errors.

John.

Share this post


Link to post
Share on other sites