Home > Back-end > The FILE * fp=fopen (OpenDialog1 -> FileName. The c_str (), "rb"); XE8 file read always
The FILE * fp=fopen (OpenDialog1 -> FileName. The c_str (), "rb"); XE8 file read always
Time:09-29
The FILE * fp=fopen (OpenDialog1 - & gt; FileName. C_str (), "rb"); XE8 file read always prompt error, how to change
CodePudding user response:
What error message?
CodePudding user response:
AnsiString STR=OpenDialog1 - & gt; The FileName. The FILE * fp=fopen (STR) c_str (), "rb");
CodePudding user response:
First, using the FILE in XE series, libraries need to quote the stdio. H
# include & lt; Stdio. H>//reference stdio. H library
Second, in a series of XE has wide characters used by default, it is recommended to use the wide character function of form a complete set _wfopen to read and write files
# include & lt; Stdio. H>//reference stdio. H library
Void __fastcall TForm1: : Button1Click (TObject * Sender) { The FILE * outf;//define a file pointer If (OpenDialog1 - & gt; The Execute ()) { Outf=_wfopen (OpenDialog1 - & gt; FileName. W_str (), L "rb"); } }