Quick hack convert M$ favorites to html list
#include <>
#include <>
#include <>
#include <>
#include <>
#include <>
#define PACKAGE "forvavo"
/* recursion */
void recdir(char *dir);
int main(int argc, char *argv[]) {
if(argc != 2)
fprintf(stderr, "%s [directory]\n", PACKAGE), exit(EXIT_FAILURE);
else {
printf("\n");
printf(" \n");
printf(" \n");
printf(" \n");
printf("\n");
recdir(argv[1]);
printf("\n");
printf("\n");
}
return 0;
}
void recdir(char *dir) {
DIR *dp;
FILE *fp;
char *ptr;
char line[1024];
struct dirent *entry;
struct stat statbuf;
if((dp = opendir(dir)) == NULL) {
fprintf(stderr, "Cannot open directory: %s\n", dir);
return;
}
chdir(dir);
while((entry = readdir(dp)) != NULL) {
stat(entry->d_name, &statbuf);
if(S_ISDIR(statbuf.st_mode)) {
if(strcmp(".", entry->d_name) == 0 || strcmp("..", entry->d_name) == 0)
continue;
printf("\n%s
\n", entry->d_name);
printf("\n"); recdir(entry->d_name); } else { if((fp = fopen(entry->d_name, "r")) == NULL) perror(PACKAGE); else { while((fgets(line, 1024, fp)) != NULL) { if(strncmp(line, "URL=", 4) == 0) { printf("
if(*ptr != '\n' && *ptr != '\r') printf("%c", *ptr);
printf("\">%s\n", entry->d_name);
} /* while */
} /* else */
fclose(fp);
} /* else *
Read more: http://cmagical.blogspot.com/2010_02_14_archive.html#ixzz0xgXu6hTq
Under Creative Commons License: Attribution Non-Commercial No Derivatives
Labels
- ajax (1)
- Assembly Programming (3)
- Books on C++ (6)
- C Programs (35)
- Challenging Question (1)
- Class (1)
- Complete Script (1)
- Computer Graphics (1)
- CSS (2)
- Datastructure (6)
- Download (3)
- e-books (8)
- Errors (1)
- FTP (2)
- HTML (3)
- Interview Questions (8)
- Introduction (1)
- Methods (2)
- OOP (1)
- Operator Overloading (1)
- Operators (1)
- Others (5)
- PHP (4)
- PHP Errors (1)
- PHP Script (1)
- Programming (3)
- Question Bank (6)
- Short Questions (1)
- SQL (1)
- Tips (1)
- Tricks (1)
- Tricky Programs in C (2)
- Useful Scripts (1)
- WAP (1)
- Web (3)
- XHTML (1)
Small Programs in c sample source codes(Quick hack convert M$ favorites to html list)
Wednesday, August 25, 2010Posted by Xofth at 10:01 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment