在Windows环境下,利用高级语言编程环境(限定为VS环境或VC环境)调用相关的系统调用(CreateProccess,即系统API)实现一个包括“进程创建,文件读写”功能的应用程序。有一个文本文件CommandList.txt,第一行是说明性文字:本文件最后一次打开和运行日期是20200224。第二行开始每行是一个可执行程序的名称(含路径)。编写一个应用程序能打开该文件,顺序执行其中的每个程序,并将文件第一行中的日期更新为当前日期。说明:文本文件CommandList.txt直接用记事本创建即可,以下为该文件的一个实例,可以自己设计该文件中第2行开始的内容。
本文件最后一次打开和运行日期是20200224 c:\Windows\system32\notepad.exe c:\Windows\system32\calc.exe c:\Windows\system32\mspaint.exe
代码如下:
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
int main()
{
time_t timep;
struct tm *p;
time (&timep);
p=gmtime(&timep);
int number1=1900+p->tm_year;
int number2=1+p->tm_mon