vince@cvs.rochester.edu (Vincent Ferrera) (03/26/91)
I am trying to write an application in C which will access information in the volume-control-block queue. Looking in Inside Mac v. II, I noticed that all the queue elements for all OS queues are defined as a variant record in Pascal. I tried the following code: QHdrPtr vcb_head; QElemPtr vcb_elem; vcb_head = GetVCBQHdr(); vcb_elem = (*vcb_head).qHead; I naively assumed that I could then access the information in the volume control block by simply doing, e.g. volname = (*vcb_elem).vcbVN; To which the Think C compiler responded, "Surely you jest, I don't know anything about struct/union member 'vcbVN'." Using the debugger, I found that (*vcb_elem) contained only three fields: qLink, qType, and qData. Furthermore, qData was just an array, not a struct. I looked at the elements of qData and could figure out roughly which ones corresponded to the vcb info I wanted, but this struck me as an inelegant solution. Does anyone know a better way? Is there a general method for translating pascal variant record into C? Just asking, Vincent Ferrera