Greetings,
I need to get the adress of a wave file, I used and OpenFile dialog to get the path, now I want to transform the AnsiString into an address (in other words, I want to change a path into an adress). Here's a piece of code that I wrote for an on-click event, I have no clue on how to get the address of the char * string :
void __fastcall TFORM_SonoDrive::CMD_OpenAudioStreamClick(
TObject *Sender)
{
WORD * Addr;
Char * CharPath;
AnsiString StrPath;
if (ODG_OpenAudioStream->Execute())
{
StrPath = ODG_OpenAudioStream->FileName;
CharPath = StrPath.c_str();
Label1->Caption = StrPath;
Label2->Caption = CharPath; // the path is ok
// get an address out of a path :
// *Addr = *((WORD *)CharPath); <- crashes at run-time
}
}
I tried a typecast but it crashed.
Simon Lapierre
slapierre@sonomax.com
I need to get the adress of a wave file, I used and OpenFile dialog to get the path, now I want to transform the AnsiString into an address (in other words, I want to change a path into an adress). Here's a piece of code that I wrote for an on-click event, I have no clue on how to get the address of the char * string :
void __fastcall TFORM_SonoDrive::CMD_OpenAudioStreamClick(
TObject *Sender)
{
WORD * Addr;
Char * CharPath;
AnsiString StrPath;
if (ODG_OpenAudioStream->Execute())
{
StrPath = ODG_OpenAudioStream->FileName;
CharPath = StrPath.c_str();
Label1->Caption = StrPath;
Label2->Caption = CharPath; // the path is ok
// get an address out of a path :
// *Addr = *((WORD *)CharPath); <- crashes at run-time
}
}
I tried a typecast but it crashed.
Simon Lapierre
slapierre@sonomax.com