home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!usc!rpi!abduls
- From: abduls@aix.rpi.edu (Saiful Azuan Abdul Aziz)
- Subject: Please help me pull this string
- Message-ID: <q8m2+qj@rpi.edu>
- Nntp-Posting-Host: aix.rpi.edu
- Organization: Rensselaer Polytechnic Institute, Troy NY
- Date: Thu, 17 Dec 1992 18:34:22 GMT
- Lines: 60
-
-
- Hai there,
- I'm new in Mac programming (infact, I'm new in programming in
- general). Anyway, I need to get some information out of one resource.
- What I need is how can I get the data structure of pascal string. When
- I open the resource using ResEdit, I can built the templates for this resource.
- My template looks like this (in ResEdit)
-
- LABEL FIELD TYPE
- # of Data ZCNT
- **** LSTC
- Starting Pts DLNG
- Ending Pts DLNG
- Line Name PSTR
- **** LSTE
-
- When I translated this to my C data structure, I make it somthing like
- this
-
- struct MyData{
- long StartPt;
- long EndPt;
- Str255 LineName;
- };
- typedef struct MyData MyData;
-
- struct MyRealData{
- long NumOfData;
- MyData theData[];
- };
- typedef struct MyRealData MyRealData;
-
- My problem is that I can't get the pascal string working when I did the
- BlockMove. The pascal string is not in constant size. It is stored in N+1 byte
- style. (N is # of character). Below is the code that I did to get my
- resource (part of it)
-
- ...
- MyRealData gPreference;
- ...
- resHandle = Get1Resource('LINE', 128);
- if (resHandle != NIL) {
- MoveHHi(resHandle);
- HLock(resHandle);
- BlockMove(*resHandle, (Ptr)&gPreference, (long) sizeof(MyRealData));
- HUnlock(resHandle);
- ReleaseResource(resHandle);
- }
- ...
-
- gPreference.theData[0] give me a right result, but not the rest of the
- array. My question is, what is the right way to get this kind of data.
- I'm hoping that there is a mac guru out there in the net that could
- help me with this pascal string.
-
- Thanks in advance.
-
- SAIFUL AZIZ
- internet:abduls@rpi.edu bitnet:saiful@rpitsmts aol:azrin compu$erve:70760,371
- disclaimer: help me!!!!!!!! what should i say over here???????
-