Hey, I have aquired a massive amount of .wma's from my father, and I have a command to convert the .wma's to .ogg's. I am gonna try and code a program that would do all of this for me. The program compiles with a warning of
Code:
radiohead@w00den-pickle:~/programming/C$ gcc wma_convert.c
wma_convert.c: In function ‘main’:
wma_convert.c:8: warning: initialization from incompatible pointer type
It isn't that big of a deal...I think, but if it can be fixed, please tell me how.
But that isn't why I am posting.
The pointer to wma_file (ogg_file) is supposedly incremented until it reaches the end of the string or file name, then decremented until it reaches a '.', then add "ogg" in place of that. but what happens is that it deletes everything before the period and adds "ogg" to the end of the untouched filetype resulting in something like this.
This includes compilation errors/warnings and what happens when program is run.
Code:
radiohead@w00den-pickle:~/programming/C$ gcc -o wma_convert wma_convert.c
wma_convert.c: In function ‘main’:
wma_convert.c:8: warning: initialization from incompatible pointer type
radiohead@w00den-pickle:~/programming/C$ ./wma_convert
What file (WMA) do you want to convert?
:test.test
Original filename: test.test
New filename: .testogg
radiohead@w00den-pickle:~/programming/C$
Here is the source as of now. The command to convert is commented out as not to cause any confusion on the compiler's part.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv)
{
char wma_file[1024];
char *ogg_file = &wma_file;
char line[1024];
printf("What file (WMA) do you want to convert?\n:");
fgets(line, sizeof(line), stdin);
sscanf(line, "%s", &wma_file);
printf("Original filename:\t %s\n", wma_file);
while(*ogg_file != '\0')
*ogg_file = *ogg_file++;
while(*ogg_file != '.')
*ogg_file = *ogg_file--;
strcat(ogg_file, "ogg");
printf("New filename:\t %s\n", ogg_file);
// system("gst-launch-0.8 filesrc location=\"file.wma\" ! decodebin ! vorbisenc ! filesink location=\"file.ogg\"");
return (0);
}
I hope you can help.