#include
#include
If direct use fopen (" aaaa. TXT ", "r") and strcpy (tmpstr20, "12345"), you can compile;
And if you use a variable, such as fin=fopen (OpenDialog1 - & gt; Files - & gt; Strings [I] c_str (), "r");
Strcpy (tmpstr20 OpenDialog1 - & gt; Files - & gt; Strings [I] c_str ());
The compiler error:
[bcc32c Error] Unit1. CPP (45) : no matching function for the call to 'fopen'
[bcc32c Error] Unit1. CPP (46) : no matching function for the call to 'strcpy'
Not seen this kind of phenomenon in bcb6.0, and in more advanced 10.3 appeared, ask tall person to help me, I install problems are there? There are Settings I didn't understand? Where is the problem?
First thank you!!!
CodePudding user response:
From 2009 later, c + + Builder the default string type UnicodeString by AnsiString instead, such as Edit1 - & gt; Text, OpenDialog1 - & gt; Files - & gt; Strings are [I], UnicodeString: : c_str () is of type would be * type, not char * type, so either use AnsiString (Edit1 - & gt; Text). C_str (), or wide character version, using the fopen function may be wfopen function,CodePudding user response:
There is a c + + Builder wide character (string) data:http://www.cppfans.com/cbknowledge/skills/strings/
CodePudding user response:
Strcpy wide character version may be wcscpy, wide char string copy