Write text file question
Posted: Fri May 27, 2011 6:35 am
Encountered a problem
I have several "text_string"actors , and one "text_string_new " actor containing text. Task is to write text from those actors into text file. Program (see code) writes them into one string. And i want to make it list.
I mean:
text_string_newtext_string 0text_string 1text_string 2text_string 3text_string 4 - it's current result
But i need
text_string_new
text_string 0
text_string 1
text_string 2
text_string 3
text_string 4
What i'm doing wrong ?
P.S:
getFullName function gets name of actor in "name.cloneindex" format
I have several "text_string"actors , and one "text_string_new " actor containing text. Task is to write text from those actors into text file. Program (see code) writes them into one string. And i want to make it list.
I mean:
text_string_newtext_string 0text_string 1text_string 2text_string 3text_string 4 - it's current result
But i need
text_string_new
text_string 0
text_string 1
text_string 2
text_string 3
text_string 4
What i'm doing wrong ?
- Code: Select all
int i;
Actor*A1;
FILE * textFile = fopen("textFile.txt", "w"); // open file
fputs(text_string_new.text,textFile); // write new string first
for (i=0; i<ActorCount("text_string"); i++)
{
A1=getclone(getFullName("text_string",i));
fputs(A1->text,textFile); // write other strings
}
fclose(textFile);
P.S:
getFullName function gets name of actor in "name.cloneindex" format