
char to int, int to char...
Hi, all. Thanks in advance.
I've reading a couple of nice books and a bunch of tutorials, and finally
decided to write some small program just to satisfy myself.
I have some directory where all the filenames are uppercased. I'm trying
to rename each file to corresponding lowercase letters.
Here's how I approached.
char *filename[MAX];
char fileList[N];
FILE *ifp;
system("ls > tmpfile");
ifp = fopen("tmpfile", "r");
for(int i = 0; fscanf(ifp, "%s", fileList) == 1; ++i) {
filename[i] = calloc(strlen(fileList) + 1, sizeof(char));
strcpy(filename[i], fileList);
Quote:
}
Here's the dillema. Now I need to somehow convert this char * to int in
order to use tolower(). Then again I need to convert this int from
tolower() to char *, to later use rename(char *, char *).
How would I do this?
I guess I'm really confused, and am sorry to waste bandwidth with this
newbie question.
Again, thanks in advance.
Dae