diff --git a/audio_control.cpp b/audio_control.cpp new file mode 100644 index 0000000..9f07c3d --- /dev/null +++ b/audio_control.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +void ring(const string& path){ // 修改参数类型为const string& + //响铃命令例:powershell -c (New-Object Media.SoundPlayer 'ring.wav').PlaySync() + string ring_path="powershell -c (New-Object Media.SoundPlayer '"; + if(path=="none"){ + Beep(500,500); + Sleep(200); + Beep(500,500); + Sleep(200); + Beep(500,500); + cout<<"test"<> path; + string line; + while (getline(file, line)) { + // 创建一个字符串流来分割每一行的数据 + stringstream ss(line); + string cell; + // 创建一个一维向量来存储一行的数据 + vector row; + row.clear(); // 清空row向量,避免数据重复和内存浪费 + // 读取每一个单元格 + while (getline(ss, cell, ',')) { + // 把单元格的数据放到一维向量中 + row.push_back(cell); + } + // 把一维向量放到二维向量中 + path.push_back(row); + } + // 关闭文件 + file.close(); // 关闭文件,避免内存泄漏和文件占用 + + assert(!path.empty()); // 判断data是否为空,如果为空,抛出异常 + cout<<"path1"<