The following code opens up an "Open Dialog" window and the user selects a file then the filename gets inserted into a text box. Though there is a problem.... the filename's have ununsual characters.. EG.. ('text.txt' will be 'text.txt™pw™')...
Can anyone see any fault in the follwing code:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">void Open_Dialog()
{
int count=1;
AEDesc defaultLocation;
NavReplyRecord reply;
NavDialogOptions dialogOptions;
NavGetDefaultDialogOptions ( &dialogOptions );
NavGetFile ( &defaultLocation, &reply, &dialogOptions, nil, nil, nil, NULL, nil );
while( count == 1 )
{
AEKeyword theKeyword;
DescType actualType;
Size actualSize;
FSSpec documentFSSpec;
AEGetNthPtr(&(reply.selection), 1, typeFSS, &theKeyword, &actualType, &documentFSSpec, sizeof(documentFSSpec), &actualSize);
Display_Filename( documentFSSpec.name );
count++;
}
}
void Display_Filename( StrFileName Filename )
{
CFStringRef Output;
ControlRef Text1;
ControlID Text1ID;
Text1ID.signature = 'Matt';
Text1ID.id = 131;
GetControlByID( Window, &Text1ID, &Text1 );
Output = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"

, Filename);
SetControlData( Text1, 0, kControlEditTextCFStringTag, sizeof(CFStringRef), &Output );
DrawOneControl( Text1 );
}</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">