如何在C ++中使用Dos命令播放歌曲? [英] How Do I Play A Song Using Dos Command In C++?

查看:96
本文介绍了如何在C ++中使用Dos命令播放歌曲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几次我注意到了这件事。我想通过在我的c ++程序中编写DOS命令来播放一首歌,这是一个系统(start C:\ temp \song.mp3)。当我编写代码时,只有C驱动器打开,但它不播放歌曲。我在命令提示符窗口中输入了命令separetly并打开了歌曲。我还尝试通过键入DOS命令(例如system(start C:\ temp))从c ++打开文件夹。我注意到只有C文件夹打开,任何超过C的命令都根本不执行。我想知道这些命令是否适用于c ++,或者我可能在某处犯了错误。我想知道除了用c ++导入外部库来播放一首歌(我之前尝试过它并且它有效),有什么方法我可以通过在我的c ++程序中用DOS命令编写并播放一首歌或打开一首歌来播放一首歌一个文件夹。谢谢。

解决方案

你没有解释你是如何试图调用start someFile.mp3的,但你不应该使用这个词,start。去掉它。它仅适用于批处理文件,意味着应该启动一些应用程序并继续而不等待处理完成的时刻。



-SA

Its been couple of times that i have noticed this thing. I wanted to play a song by writing a DOS command in my c++ program which is system("start C:\temp\song.mp3"). When,i complied the code only the C drive opens up but it doesn't play the song. I typed the command separetly in my command prompt window and the song opens up. I also tried to open folders from c++ by typing in DOS commands such as system("start C:\temp"). I noticed that only the C folder opens up and any command past beyong C doesn't execute at all. I was wondering if such commands are not applicable in c++ or may be i am making a mistake somewhere. I was wondering other than importing external libraries in c++ to play a song(which i tried before and it worked), is there any way i can play a song by writing in DOS commands in my c++ program and making it play a song or open a folder. Thanks.

解决方案

You did not explain how exactly you tried to invoke "start someFile.mp3", but you should not use this word, "start". Remove it. It is specific only for batch files and means that the shall should start some application and continue without waiting for the moment of time when the process is complete.

—SA


这篇关于如何在C ++中使用Dos命令播放歌曲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆