R
Rudra Banerjee
Dear friends,
I am a C novice. I am trying to get the basename of a file(filename) without extension. The problem is much discussed in net, but due to my limited knowledge, I failed to make fruitful use of them, and thought I may use the unix command, as given.
char myCommand[512];
// char *basetmp=strrchr(filename,'/')+1;
sprintf(myCommand,"basename %s .bib",filename);
char *basefn=system((char *)myCommand);
printf (basefn);
variable filename is defined as char*.
This code is giving warnning:308:18: warning: initialization makes pointer from integer without a cast [enabled by default]
where line no 308 is "char *basefn=system((char *)myCommand);"
If anybody kindly show me where I am getting wrong, or better still, a better(and small) method to get the same function without unix command, it will be of huge help.
I am a C novice. I am trying to get the basename of a file(filename) without extension. The problem is much discussed in net, but due to my limited knowledge, I failed to make fruitful use of them, and thought I may use the unix command, as given.
char myCommand[512];
// char *basetmp=strrchr(filename,'/')+1;
sprintf(myCommand,"basename %s .bib",filename);
char *basefn=system((char *)myCommand);
printf (basefn);
variable filename is defined as char*.
This code is giving warnning:308:18: warning: initialization makes pointer from integer without a cast [enabled by default]
where line no 308 is "char *basefn=system((char *)myCommand);"
If anybody kindly show me where I am getting wrong, or better still, a better(and small) method to get the same function without unix command, it will be of huge help.