using chdir in c, chdir function in c,

chdir Example program in C, chdir Demo in C, program using chdir function in C


#include
#include
#include
#include

const char * const path = "d:/popsys/test";
const char * const file = "lernc.txt";

int main () {
printf ("Changing directory to <%s>\n", path);

if (chdir (path) == -1) {
printf ("chdir failed - %s\n", strerror (errno));
}else {
printf ("chdir done !!!\n");
printf ("directory content of '%s'\n\n", path);
system ("ls -l");
printf ("\n");
printf ("checking the content of '%s'\n", file);
system ("cat lernc.txt");
}
return 0;
}



No comments:

Post a Comment