Listing 1: Building a typical QTAtom structure
QTAtomContainer       aContainer = nil;
QTAtom                anAtom = nil;
long                  aLong = 0;
 
	// create the QTAtomContainer
anError = QTNewAtomContainer(&aContainer);
 
	// add some name-data pairs to the root
aLong = 7;
anError = QTInsertChild(
			aContainer,     // the container
			0,              // the atom, zero = root
			'data',         // the name		
			1,              // the ID
			0,              // the index of name-ID pairs
			sizeof(aLong),  // the size of the data
			&aLong,         // the pointer to the data
			nil);           // returns a ref to the new QTAtom
 
aLong = 3;
anError = QTInsertChild(aContainer, 0, 'data', 2, 0, sizeof(aLong), &aLong, nil);
 
	// create an empty atom
anError = QTInsertChild(aContainer, 0, 'more', 1, 0, 0, nil, &anAtom);
 
	// add some atoms to it
aLong = 2;
anError = QTInsertChild(aContainer, anAtom, 'stff', 1, 0, sizeof(aLong), &aLong, nil);
 
aLong = 14;
anError = QTInsertChild(aContainer, anAtom, 'xtra', 1, 0, sizeof(aLong), &aLong, nil);
 
	// make sure to dispose of it when you're done
anError = QTDisposeAtomContainer(aContainer);