Adding stuff to strings from files..
This is probably very stupid, but I'm a beginning programmer and I'd like your help.
I have a text-file with lines like this:
bla bla bla !end!
Now I want my program to ad all the words from a line to a variable, until it reaches "!end!". So if my program would read from the above line the value of the variable would be "bla bla bla". I tried it with this (only a small piece):
Code:
ifstream my_file("rode.txt");
my_file>>part_of_total;
while (part_of_total!="!end!")
{
strcat(totalname," ");
strcat(totalname,part_of_total);
my_file>>part_of_total;
}
I know, my coding in general sucks ;) But do you guys have tips or something for me to achieve this?
Doesn't have to be an anhanced methode of my coding, new coding would rock ;)
Thanx in advance!