I have a text file with a bunch of links in it. I want to be able to create URL links for each one so I could put them in my bookmarks. The name for each link would be the link, with the special chars taken out. This is what I got.
Code:#include <stdio.h>
#include <conio.h>
#include <string.h>
int main (void) {
FILE *indata=fopen("C:\\windows\\desktop\\urls.txt","r");
FILE *outdata;
int i;
char *ext=".url",
name[256],
url[256];
while (indata!=NULL) {
fscanf (indata,"%s", url);
name[0]='"';
strcat(name,url);
for (i=0; i<strlen(name); i++) {
if ( (name[i]=='\\') || (name[i]=='/') || (name[i]==':') || (name[i]=='*') || (name[i]=='?') || (name[i]=='"') || (name[i]=='<') || (name[i]=='>') || (name[i]=='|') )
name[i]='-';}
strcat(name,ext);
outdata=fopen(name,"w");
fprintf (outdata,"[InternetShortcut]\n");
fprintf (outdata,"URL=%s\n",url);
fclose(outdata);
}
fclose(indata);
return 0;