www.delorie.com/archives/browse.cgi | search |
From: | Weiqi Gao <weiqigao AT a DOT crl DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Read text from file |
Date: | Sat, 14 Aug 1999 17:45:10 -0500 |
Organization: | CRL Network Services |
Lines: | 19 |
Message-ID: | <37B5F176.9D776549@a.crl.com> |
References: | <7p4op7$8qs$1 AT nnrp1 DOT deja DOT com> |
NNTP-Posting-Host: | a116019.stl1.as.crl.com |
Mime-Version: | 1.0 |
X-Mailer: | Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i586) |
X-Accept-Language: | en |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
JustinFL wrote: > > I'm kind of a newbie and i can't figure out how to read text (any type) > from a file into a program, and even write that text into another file. > i was wondering the simplest way to do this using streams. i am using > the DJGPP compiler for C++. Thanks! To write to a file: ofstream ofs("filename"); ofs << 1; To read from a file: ifstream ifs("filename"); int i; ifs >> i; -- Weiqi Gao weiqigao AT a DOT crl DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |