int main() { int levelNum, pathNum; getPathAndLevelNumbers(&levelNum, &pathNum); char *filePath = makeFilePath(levelNum, pathNum); checkForDuplicateFile(filePath); initSDL(); Display d = (Display)malloc(sizeof(struct display)); openMapInSDLWindow(d); FILE *tmpFP = createTempFile(); int numberOfCoords = recordStepsInTempFile(tmpFP, d); writeCoordsToFile(numberOfCoords, tmpFP, filePath); return 0; }
//prints difference between stored date and present void printDiff (State *s) { s->next = NULL; FILE *in = fopen(makeFilePath(), "rb"); if (in == NULL) { printf("No date stored. Try to store one by calling \"ctd -s [date]\"\n"); return; } double jstored; fread(&jstored, sizeof(double), 1, in); fclose(in); TDate *present = currentDate(NULL); double jpresent = toJulian(present); TDateDiff *diff = tdiff(jstored, jpresent); printDateDiff(diff); printf("\n"); free(present); free(diff); }
char * makeTextTablePath (const char *directory, const char *name) { char *subdirectory = makePath(directory, TEXT_TABLES_SUBDIRECTORY); if (subdirectory) { char *file = makeFilePath(subdirectory, name, TEXT_TABLE_EXTENSION); free(subdirectory); if (file) return file; } return NULL; }
//prints a live countdown relative to stored date void printCountdownStored (State *s) { s->next = NULL; FILE *in = fopen(makeFilePath(), "rb"); if (!in) { printf("No date stored. Try to store one by calling \"ctd -s [date]\"\n"); return; } double jdate; fread(&jdate, sizeof(double), 1, in); fclose(in); TDate *now = currentDate(NULL); double jnow = toJulian(now); countdown (jnow, jdate); }
WCHAR* fileManage::getUsePath(const UINT num, WCHAR* dirPath, WCHAR* suffix) { if(useVolume!=NULL || realizePath!=NULL) { delete[] useVolume; delete[] realizePath; } int vlen = makeVolume(num); int plen = wcslen(dirPath); makeDir(dirPath, vlen, plen); if(dirPath[plen-1]!=L'\\') { plen++; } int flen = randomFileName(); int slen = wcslen(suffix); int len = vlen+plen+flen+slen; realizePath = new WCHAR[len]; makeFilePath(dirPath, suffix); return realizePath; }
String makeUrlFilePath(const String &url, const String &filename) { return makeFilePath(url, filename); }
char * makeTextTablePath (const char *directory, const char *name) { return makeFilePath(directory, name, TEXT_TABLE_EXTENSION); }