Hi,
I'm having difficulty in converting an ansiString to a string, i've searched loads on this but could only find how to convert a string to an ansistring.
I'm tring to open a filestream for reading using the filename selected by the value of an open file dialog.
Code below explains
if (OpenFileDialog->Execute())
{
dave = OpenFileDialog->FileName;
std::ifstream
infile(dave.c_str(), std::ios::in | std::ios::binary);
}
The program fails due to it not reading dave the filename correctly, I've tried loads of different ways of declaring dave, by using AnsiString as FileName returns ansiSting, but couldn't convert it back to string :rolleyes:
if i just had the code as
dave = "H:\\MyDocuments\\file";
std::ifstream
infile(dave.c_str(), std::ios::in | std::ios::binary);
it works fine!!!
I'm really confused with this, can anybody offer any advise?
Thanks