I need to choose a txt
file through OpenDialog
, to open through fopen
. The problem I'm encountering and the conversion. The fopen
function has as parameter const char
, since opendialog
returns the file path as a ansistring
(follow the code)
void __fastcall TForm1::Button2Click(TObject *Sender)
{
AnsiString Arquivo;
FILE *Fin;
if(OpenDialog1->Execute())
Arquivo = OpenDialog1->FileName;
Fin = fopen(Arquivo,"rt") ;
Button1->Enabled = true;
}
//-----