Valhalla Legends Forums Archive | General Programming | Help is needed!

AuthorMessageTime
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?
February 12, 2003, 12:58 AM
Eibro
Sure!
[code]
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);
[/code]

February 12, 2003, 1:06 AM
Zakath
First of all, std::string?!! Why?!

Second, he wanted Visual Basic code. :P
February 12, 2003, 1:28 AM
DarkOne
I don't speak CPP  :-/

Thanks for trying  ;)
February 12, 2003, 7:03 PM
Eibro
[quote]First of all, std::string?!! Why?!

Second, he wanted Visual Basic code. :P[/quote]
Bah! [link=http://www.parashift.com/c++-faq-lite/containers-and-templates.html#faq-34.1]Why not?[/link]
February 12, 2003, 11:35 PM
Zakath
Ewww!

*notes that his first C++ instruction book taught pointers and arrays well before it ever touched the standard templates*
February 13, 2003, 1:26 PM

Search