On Mon, 6 Aug 2001, Keith Rollin wrote:
> >>  #define stringRsrc 'tSTR'
> >>  type stringRsrc {align word; cstring;};
> >>  read stringRsrc (2000) "Help_x";
> >
> >read stringRsrc (2000) "Help_x\0";
> >
> >   tried that?
> 
> Step a little closer to the e-mail when you read it.  :-)  See where 
> Paul said '"Help_x" is a MetroWerks text file saved in a Mac format'? 
> NULL-terminating the name of the file isn't going to help.
  
  /me slaps himself - its 4:41am in my normal time zone :) thats my
  excuse..

> My own suggestion would be to add a snippet of code that would 
> NULL-terminate the resource if it weren't already.  Or remove the 
> requirement that the string be NULL-terminated.

{
  Char      *string;
  UInt16    size;
  MemHandle memHandle;

  memHandle = DmGet1Resource('tStr', id);
  size      = MemHandleSize(memHandle);
  string    = (Char *)MemPtrNew(size+1);
  StrCopy(string, MemHandleLock(memHandle)); 
  MemHandleUnlock(memHandle);
  string[size] = '\0';
  DmReleaseResource(memHandle);

  ... 

  MemPtrFree(string);
}

  maybe that can rectify it :P

// az "wake up boy"..
[EMAIL PROTECTED]
http://www.ardiri.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to