// code to convert favorites directory to an HTML page /* *.url file stored as [InternetShortcut] URL=http://www.stv.ee/~trushkin/viruses/ Modified=B0FEC7D13FCDBC010F */ /* convert it to

Arcade Emulation - davesclassics.warzone.com

*/ #include #include #include #include void ConvertFile(const char * fname) {// read file and output HTML version FILE * infile; if (fname == NULL) return; if ((infile = fopen(fname,"rt")) == NULL) return; char line[1000]; fgets(line,1000,infile); // first needs skipped fgets(line,1000,infile); // should contain something like // URL=http://www.stv.ee/~trushkin/viruses/ char name[500]; strcpy(name,fname); if (strlen(name) > 4) name[strlen(name)-4] = 0; // chop .url out if (strlen(line) > 0) line[strlen(line)-1] = 0; // chop \n off printf(" %s
\n",line+4,name); //

Arcade Emulation - davesclassics.warzone.com

fclose(infile); } // ConvertFile int main(void) { struct _finddata_t fileinfo; long handle; int done; handle = _findfirst("*.url",&fileinfo); done = (handle == -1); if (done) { printf("Usage: run Fav2HTML in a directory with Microsoft *.url files\n"); printf(" and capture the output to a html file, which then can be\n"); printf(" inserted into your webpages\n"); printf(" For example: fav2html > temp.html\n"); printf(" This program does not recurse subdirectories - you must do it\n"); return 0; } printf("

\n"); while (!done) { ConvertFile(fileinfo.name); done = (_findnext(handle,&fileinfo) == -1); } _findclose(handle); printf("

\n"); return 0; } // main // end Fav2HTML.cpp