-
file location problem
I am having a problem with loading files in different location on the harddrive. This is my code for finding the file but it doesnt work
Code:
int main()
{
char file[250] = "C:\\Documents of Settings\\Raigne\\Shared\\test.mp3";
wsprintf(file, TEXT("play \"%s\" type mpegvideo alias TempFile"), file );
printf("%s", file);
mciSendString(TEXT(file), NULL, 0, NULL);
system("pause");
}
it prints play like 5 times then the type mpeg. it doesnt ever put in the file name. I dont know how to do this, please help
-
You need another variable to hold the command.
Code:
int main()
{
char file[] = "C:\\Documents of Settings\\Raigne\\Shared\\test.mp3";
char command[250];
wsprintf(command, TEXT("play \"%s\" type mpegvideo alias TempFile"), file );
printf("%s", command);
mciSendString(TEXT(command), NULL, 0, NULL);
system("pause");
}
-
if you are using TEXT macro - are yuo compiling for UNICODE?
In this case you not complient enogh...
Should be TCHAR not char, for example...
You should revise your code, currently it is good only for non-UNICODE version, in this case there is no need to use TEXT macro at all
-
ah, I see. is wsprintf even a C++ function or is it C?
-
both can use it (but C++ has some other ways to manipulate strings)