1.
UnicodeString Db=cxDBTextEdit59 - & gt; The Text;
//assume that string for "because of work demand, with a program changes to the text file" the words;
AnsiString Cstr=Db;//I don't understand why we have to use the UnicodeString instead of the previously AnsiString,
Char SCH [64].
Int I, j;
J=Cstr Length ();//
for(i=0; i
SCH [I]=Cstr [I + 1);//the first subscript AnsiString starting from 1, the array from zero beginning,
}
Fprintf (px, "% s", SCH);///
2. The UnicodeString Db=cxDBTextEdit59 - & gt; The Text; ;
Char * cp=new char [Cstr. Length () + 1);
__try
{
Strcpy (cp, Cstr c_str ());
Fprintf (px, "% s", SCH);///
}
__finally
{
The delete [] cp;
}
The above results are unable to open the text file, use the viewer found that both methods assignment for gibberish, hope the great god help answer, thank you!!!!!!!!!!!!!!!!!!!!!
CodePudding user response:
Should be no problem, in the second, for example:UnicodeString Db=Edit1 - & gt; The Text;
The FILE * p=fopen (" temp. TXT ", "w");
AnsiString Cstr=Db;
Char * cp=new char [Cstr. Length () + 1);
__try
{
Strcpy (cp, Cstr c_str ());
Fprintf (px, "% s", cp);//not SCH
}
__finally
{
The delete [] cp;
}
The fclose (px);
CodePudding user response:
Thank you upstairs, but are wrong clew, assignment in executable program are garbledCodePudding user response:
You should make sure what's your text file format, text files are ASCII or unicode,,CodePudding user response: