| delorie.com/archives/browse.cgi | search |
| From: | "bowman" <bowman AT montana DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| References: | <3acf99f6 DOT 7c0b DOT 0 AT surfeu DOT fi> |
| Subject: | Re: Read with C++ <fstream.h> |
| Lines: | 34 |
| X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
| Message-ID: | <71Oz6.713$qG1.3238@newsfeed.slurp.net> |
| Date: | Sat, 7 Apr 2001 18:17:35 -0600 |
| NNTP-Posting-Host: | 208.4.224.142 |
| X-Trace: | newsfeed.slurp.net 986688707 208.4.224.142 (Sat, 07 Apr 2001 19:11:47 CDT) |
| NNTP-Posting-Date: | Sat, 07 Apr 2001 19:11:47 CDT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Mr. Veli Suorsa" <VJSuorsa AT Surfeu DOT Fi> wrote in message
news:3acf99f6 DOT 7c0b DOT 0 AT surfeu DOT fi...
> Hi!
> Can you help me with this C++ conversion?
#include <vector>
#include <fstream>
#include <string>
#include <iostream>
int main(int argc, char** argv)
{
std::ifstream input(argv[1]);
std::vector<std::string> v;
std::string line;
if (std::getline(input, line) {
v.push_back(line);
lines++;
std::cout << line << std::endl;
}
input.close();
std::cout << "read " << lines << " from " << argv[1] << std::endl;
return 0;
}
just typed it in off the top of my head -- needs polishing.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |