Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Dynamically...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 8 Topic 9582 of 9830
Post > Topic >>

Re: Dynamically read string

by Maciej Sobczak <see.my.homepage@[EMAIL PROTECTED] > May 9, 2008 at 09:16 AM

On 9 Maj, 05:29, howa <howac...@[EMAIL PROTECTED]
> wrote:

> Are there any simple method to read string into dynamic array of
> string

Of course:

vector<string> lines;
string line;
while (getline(cin, line)) // or wherever data comes from
{
     lines.push_back(line);
}

That's it.

> e.g. char**

The version with char** is so much advanced that I would be afraid to
even try - the risk of getting it wrong it too high, unless you have a
really solid justification for it.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 8 Posts in Topic:
Dynamically read string
howa <howachen@[EMAIL   2008-05-08 21:29:23 
Re: Dynamically read string
Marcin Swiderski <sfid  2008-05-09 09:15:18 
Re: Dynamically read string
Maciej Sobczak <see.my  2008-05-09 09:16:01 
Re: Dynamically read string
Oncaphillis <oncaphill  2008-05-09 09:24:35 
Re: Dynamically read string
Bob Lied <lied@[EMAIL   2008-05-09 09:28:53 
Re: Dynamically read string
"Jim Langston"   2008-05-09 09:22:45 
Re: Dynamically read string
"Martin T." <  2008-05-09 09:21:07 
Re: Dynamically read string
Ulrich Eckhardt <dooms  2008-05-09 09:27:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:44:47 CDT 2008.