Str255 Conversion
Str255 Conversion
- Subject: Str255 Conversion
- From: Craig Bakalian <email@hidden>
- Date: Wed, 12 Mar 2003 14:12:13 -0500
Hi,
I need to convert a Str255 to an NSString. I am using voice
recognition. All is well, except for the Str255. How do I do it? What
exactly is a Str255? I mean, I thought I knew everything :) Thanks in
advance...
pascal OSErr HandleSpeechDoneAppleEvent (const AppleEvent *theAEevt,
AppleEvent* reply, unsigned long refcon)
{
long actualSize;
DescType actualType;
OSErr status = 0, recStatus = 0;
SRRecognitionResult recResult;
Str255 str;
Size len;
status = AEGetParamPtr(theAEevt,keySRSpeechStatus,typeShortInteger,
&actualType, (Ptr)&recStatus, sizeof(status),
&actualSize);
if (!status && !recStatus)
status = AEGetParamPtr(theAEevt,keySRSpeechResult,
typeSRSpeechResult, &actualType, (Ptr)&recResult,
sizeof(SRRecognitionResult), &actualSize);
if (!status)
{
len = 255;
status = SRGetProperty (recResult, kSRTEXTFormat, str+1, &len);
if (!status)
{
str[0] = len;
SRReleaseObject (recResult);
}
}
if(!status)
{
NSString *myString;
myString = [NSString stringWithFormat: @"%s", str]; //This
isn't working!!!!! junk
NSLog(myString);
}
else
{
NSLog(@"duh?");
}
return status;
}
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.