| delorie.com/archives/browse.cgi | search |
| From: | JustinFL <justinfl AT netzero DOT net> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Read text from file |
| Date: | Sun, 15 Aug 1999 06:50:44 GMT |
| Organization: | Deja.com - Share what you know. Learn what you don't. |
| Lines: | 36 |
| Message-ID: | <7p5o02$s1h$1@nnrp1.deja.com> |
| References: | <7p4op7$8qs$1 AT nnrp1 DOT deja DOT com> <37B5F176 DOT 9D776549 AT a DOT crl DOT com> |
| NNTP-Posting-Host: | 4.14.66.35 |
| X-Article-Creation-Date: | Sun Aug 15 06:50:44 1999 GMT |
| X-Http-User-Agent: | Mozilla/4.61 [en] (Win95; I) |
| X-Http-Proxy: | 1.0 x26.deja.com:80 (Squid/1.1.22) for client 4.14.66.35 |
| X-MyDeja-Info: | XMYDJUIDjustinfl |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
I'm not sure i understand what you are saying....what dothe ofs and ifs
mean? are these variables that i have to define or are these functions?
say i want to read in 1 line of a file (of 80 chars).....what would this
function look like?
....do you know an online source that i could get information like this
on DJGPP.....i tried delorie, but i can't find a decent info source
In article <37B5F176 DOT 9D776549 AT a DOT crl DOT com>,
Weiqi Gao <weiqigao AT a DOT crl DOT com> wrote:
> 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
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |