Re: [Dev-C++] newbie Parsing strings
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Scott S. <age...@co...> - 2004-07-27 13:28:19
|
Like this:
ifstream in("somefile.txt");
vector<string>address;
int vectorcount;
while( getline( in, address ) )
{
address.push_back();
vectorcount++;
}
And to print the information:
for( vectorcount; vectorcount > 0; vectorcount-- )
{
cout << address[vectorcount];
}
This method uses vectors, so make sure you include <vector> For more
information, look for STL references.
Dane Ensign wrote:
>Hi all,
>
>Thank you for any help you can offer.
>
>Im trying to load a street address into cout from a text file. The
>address is a string. I can only get the string as far as the first
>space.
>For example, my value is: 123 North Oak Way. The only part I can return
>is '123'. If I seperate the values of my line with commas instead of
>spaces,
>how do I read everything between the commas or tabs, if I had used them?
>
>Best regards,
>
>Dane
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by BEA Weblogic Workshop
>FREE Java Enterprise J2EE developer tools!
>Get your free copy of BEA WebLogic Workshop 8.1 today.
>http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>
|