• Welcome to Valhalla Legends Archive.
 

Help is needed!

Started by DarkOne, February 11, 2003, 06:58 PM

Previous topic - Next topic

DarkOne

Could anyone help me by posting a simple example in Visual Basic demonstrating how to store text from a text file to an array line-by-line so I could then further manipulate those strings which were stored in the array?

Eibro

#1
Sure!
using std::string;

std::vector<string> file_contents;
std::ifstream fin("filename.txt", std::ios::in);

string temp;
while (std::getline(fin, temp))
   file_contents.push_back(temp);

Eibro of Yeti Lovers.

Zakath

#2
First of all, std::string?!! Why?!

Second, he wanted Visual Basic code. :P
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

DarkOne

#3
I don't speak CPP  :-/

Thanks for trying  ;)

Eibro

#4
QuoteFirst of all, std::string?!! Why?!

Second, he wanted Visual Basic code. :P
Bah! [link=http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.1]Why not?[/link]
Eibro of Yeti Lovers.

Zakath

#5
Ewww!

*notes that his first C++ instruction book taught pointers and arrays well before it ever touched the standard templates*
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.