简体   繁体   English

如何编写打开exe文件(spectrawin)并将数据保存到特定名称和文件夹的程序?

[英]How do i write a program that opens an exe file(spectrawin) and saves the data into a specific name and folder?

I'm using c++. 我正在使用c ++。 How do i write a program that opens an exe file(spectrawin) and saves the data into a specific name and folder? 如何编写打开exe文件(spectrawin)并将数据保存到特定名称和文件夹的程序?

Cheers 干杯

This will make a directory called Output, and pipe the output from your executable into a file called output.txt, inside that Output directory. 这将创建一个名为Output的目录,并将可执行文件的输出通过管道传递到该Output目录中的一个名为output.txt的文件。

mkdir ("Output");
chdir ("Output");
system ("spectrawin > output.txt");

Please note that I do not know what spectrawin does. 请注意,我不知道Spectrumwin会做什么。 The above code works with an exe that outputs to the console. 上面的代码与输出到控制台的exe一起使用。

Incidentally, if you need to know where your working directory currently is, use something like: 顺便说一句,如果您需要知道当前的工作目录在哪里,请使用类似以下的命令:

char workingDir [_MAX_PATH];
_getcwd( workingDir, _MAX_PATH ); 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何复制“程序文件”文件夹中的文件或文件夹 - How do I copy a file Or folder in the Program Files folder 我的程序有一个保存配置文件的 GUI,如何双击此配置文件以直接使用配置数据加载 GUI? - I have a GUI for my program that saves a config file, how can I double click on this config file to load the GUI directly with the config data? 如何用c ++编写程序以解决无法事先知道从其读取的数据文本文件中包含多少行的问题? - How do I write a program in c++ to account for not knowing in advance how many lines are included in a data text file it is reading from? 如何写入文本文件的特定行? - How do i write to a specific line of a text file? 我正在尝试编写一个加密程序,它接受一个字符串并将每个变量转换为 ascii 值,然后将文件保存到文本文件 - I am trying to write an encryption program that takes a string and converts each variable to the ascii value, then saves file to text file 如何在程序打开的文件上发出EOF信号 - How to signal EOF on a file the program opens 如何从程序中运行.exe并获取句柄 - How Do I Run an .exe From My Program and Obtain a Handle 如何运行if语句以使用file.cFileName查找特定文件或文件夹 - How do I run an if statement to find a specific file or folder using file.cFileName 我希望它在单独打开 exe 文件时关闭 - I want it to close when it opens the exe file separately 如何在执行程序时将向量写入文件以供使用? (C ++) - How do I write a vector to a file for use when executing the program? (c++)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM