void OpenNGC(char* filename, NGC** headNode){ ifstream input(filename, ios::binary); int loopCount; input >> loopCount; //assumes you've written the count to the file first for (int i = 0; i < loopCount; ++i) { NGC* newNGC = new NGC; newNGC->read(input); if (*headNode == NULL) { newNGC->next = NULL; *headNode = newNGC; } else { newNGC->next = *headNode; (*headNode)->next = newNGC; } }}
or (pseudocode)...
void OpenNGC(char* filename, NGC** headNode){ ifstream input(filename, ios::binary); double x,y,z; for (all elements) { read in x,y,x AddPoint(headNode, x,y,z); }}
[edited by - Alimonster on May 28, 2002 9:21:50 AM]