3
I need to pick a file txt through the OpenDialog, to open through fopen. The problem I’m found is in the conversion. The function fopen has as a parameter a const char, already opendialog returns the file path as a ansistring (follows 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;
}
//-----