• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Str255 Conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Str255 Conversion
      • From: Janek Priimann <email@hidden>
    • Re: Str255 Conversion
      • From: Dave Thorup <email@hidden>
    • Re: Str255 Conversion
      • From: "Clark S. Cox III" <email@hidden>
  • Prev by Date: Pictures
  • Next by Date: Re: What's with 'dark' @implementation?
  • Previous by thread: Pictures
  • Next by thread: Re: Str255 Conversion
  • Index(es):
    • Date
    • Thread