Nov 2, 2011 at 3:14pm Nov 2, 2011 at 3:14pm UTC
hello.. i really need help for my assignment.
here it is the problem :
usually we use fprintf to print a string in a file.
which just like this :
fprintf(file,"%s",comment);
but i dont know why it's null in the output.
this is what i have :
string array[100];
array[3]="xx";
fprintf(ffile,"%s",array[3]);
it's result is null,
even when i used
printf("%s",array[3];
it's still null in board.
but if i use
cout<<array[3]<<endl;
it's worked.
now my question is how can i printed it in a file ????
so it can act like fprintf function???? .
thx.
Last edited on Nov 2, 2011 at 3:19pm Nov 2, 2011 at 3:19pm UTC
Nov 2, 2011 at 3:28pm Nov 2, 2011 at 3:28pm UTC
Or try do smth like this:
printf("%s" , array[3].c_str());
Nov 3, 2011 at 12:17am Nov 3, 2011 at 12:17am UTC
Oh my God !!! It's work !!! i tried ofstream already, but i forgot to write #include<fstream> hwhwhwhwhw. Btw thx so much both of u !!! now i can continue my works !!!! God bless both of u!!!!! ^^
Nov 3, 2011 at 12:18am Nov 3, 2011 at 12:18am UTC
wtf...
What is hwhwhwhwhwhw?
Nov 3, 2011 at 2:28am Nov 3, 2011 at 2:28am UTC
that's how i laughed hwhwhwhwhwhwhw