Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!marque!lakesys!davek From: davek@lakesys.UUCP (Dave Kraft) Newsgroups: comp.periphs Subject: CD-ROM retrieval software Keywords: CD-ROM, High Sierra, etc. Message-ID: <649@lakesys.UUCP> Date: 26 May 89 03:05:09 GMT Organization: Lake Systems - Milwaukee, Wisconsin Lines: 96 Hi, Here's a program I wrote using Turbo C vers. 2.0 that searches for an entered key and displays all data on that key. The disk I'm using is the CIA's World Factbook 1988 (from Quanta Press). It doesn't work some of the time.. Any addiditions/enhancements/questions, mail them to the address below. Flames should be sent to /dev/null. Hope this helps. Dave --cut here-- /* Retrieval software for CD-ROMS using High Sierra format v. 0.5 * written by Dave k (davek@lakesys.lakesys.com or uunet!marque!lakesys!davek) * Questions should be directed to the above addresses, or FidoNet addres * 1:154/666.0. */ #include #include #include #include FILE *f1, *fopen(); main() { int c; char search[80], str[80]; clrscr(); printf("Enter string to search for: "); gets(str); to_upper(str); clrscr(); setdisk(3); /* Drive D:. change this to appropriate drive */ chdir("cia"); /* Change to appropriate subdirectory */ f1 = fopen("cia.cdt","r"); /* CIA Worldfactbook cardfile. Change to */ printf("\nSearching..."); /* appropriate file. while(fgets(search,(strlen(str)+1),f1) != NULL){ to_upper(search); conv(search); if(srch(str,search) == strlen(str)) print_info(str); } fclose(f1); setdisk(2); /* Drive C: change to appropriate drive. */ } to_upper(s) char s[]; { int i; for(i = 0; i < strlen(s); i++) s[i] = toupper(s[i]); } srch(s1, s2) char s1[], s2[]; { int cnt=0,i; for(i = 0; i < strlen(s1); i++) if(s1[i] == s2[i]) ++cnt; else continue; return(cnt); } conv(s) char s[]; { int i; for(i = 0; i < strlen(s); i++) s[i] = toascii(s[i]); } print_info(s) char s[]; { int c; clrscr(); printf("%s",s); while((c = getc(f1)) != '"'){ putchar(c); if(kbhit() != 0){ clrscr(); break; } } } -- davek@lakesys.lakesys.com uunet!marque!lakesys!davek ------------------------------------------------------------------------------ Forgetting your superuser password is just God's way of saying "BOOGA, BOOGA!"