int main (int argc, char **argv){ Window wd; int col=5, row=1, width=68, height=1; union REGS regs; struct SREGS sregs; BYTE Unit; int rc; int handle; width= strlen( copyrite); col = (80-width)/2; wd = w_open(col, row, width, height); w_print(wd,copyrite); if (argc > 1){ if ((((argv[1][0] == '-') ||(argv[1][0] == '/'))&& (argv[1][1] == '?')) || (argv[1][0] == '?')){ printf ("CACHCECD [DriverName] \n"); goto done; } else cdDriver = argv[1]; } iso = (struct ISO_CD *) pdta; hsf = (struct HSF_CD *) pdta; do { if (GetValidDriver() == -1){ printf("No valid CD Driver. Aborted.\n"); goto done; } rc = GetCDLabel(); } while (rc < 0); Unit = rc; if (GetCacheName() == -1){ printf("User selected Quit.\n"); goto done; } CanonCacheName(CacheName); handle = open(CacheName, O_BINARY); if (handle != -1){ printf("%s already exists.\n",CacheName); printf("Delete file and re-run or re-run with different cache name.\n"); close(handle); } else CacheCD(Unit); done: w_close(wd); }
void CMetalMap::SaveMetalMap() { std::string map = GetCacheName(); FILE* saveFile = fopen(map.c_str(), "wb"); assert(saveFile != NULL); fwrite(&NumSpotsFound, sizeof(int), 1, saveFile); fwrite(&AverageMetal, sizeof(float), 1, saveFile); for (int i = 0; i < NumSpotsFound; i++) { fwrite(&VectoredSpots[i], sizeof(float3), 1, saveFile); } fclose(saveFile); }
bool CMetalMap::LoadMetalMap() { std::string map = GetCacheName(); FILE* loadFile = fopen(map.c_str(), "rb"); if (loadFile != NULL) { fread(&NumSpotsFound, sizeof(int), 1, loadFile); VectoredSpots.resize(NumSpotsFound); fread(&AverageMetal, sizeof(float), 1, loadFile); for (int i = 0; i < NumSpotsFound; i++) { fread(&VectoredSpots[i], sizeof(float3), 1, loadFile); } fclose(loadFile); return true; } return false; }
virtual const string& GetHotkeyName() const override { return GetCacheName(); }