i m trying to run a mp3 file on dosbox plateform by c .i put the following code in to the batch file
start c:\xyz.mp3 and trying to call this as system("c:/a.bat"), the system funtion is returing 0 but it is not running it. But the same code working well on Cmd . i m using win 7 32 bit..
vibhu mishra
0
Newbie Poster
Recommended Answers
Jump to PostThe following works for me:
#include <cstdlib> //use 8.3 filename and directory name format //my file is in "c:\batch scripts\startmp3.bat" //To get the 8.3 directory name: //in cmd window run > dir "c:\" /x | find /i "batch scripts" system("c:\\batchs~1\\startmp3.bat"); //make sure to escape '\' //should also …
Jump to PostNote that system() returns a program status code. It is good practice to use this value for error handling.
Jump to PostI discovered another solution that lets you avoid 8.3 filenames. Use double-quotes. But you need to escape them with a '\'.
#include <cstdlib> int returnVal = 0; //need to put quotes if dir or filename contains spaces //need to escape quotes returnVal = system("\"c:/batch scripts/startmp3.bat\""); if (returnVal …
All 10 Replies
cgeier
187
Junior Poster
N1GHTS
102
Posting Whiz in Training
vibhu mishra
commented:
but i m still searching for the solution
+0
vibhu mishra
0
Newbie Poster
N1GHTS
102
Posting Whiz in Training
cgeier
187
Junior Poster
vibhu mishra
commented:
its not showing any illegal command and system() returing 0, but the problem is that my mp3 file is not playing..... on cmd same bath file work good and play mp3
+0
cgeier
187
Junior Poster
cgeier
187
Junior Poster
vibhu mishra
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cgeier
187
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.