1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <windows.h>
- #define INPUTPATH "D:\\Bolshakov41p\\Processes\\Files\\Input.txt"
- #define PATHDOTHA "D:\\Bolshakov41p\\Processes\\x64\\Debug\\Processes.exe"
- int main()
- {
- HANDLE InputFile;
- InputFile = CreateFileA(INPUTPATH,
- GENERIC_READ,
- 0,
- NULL,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
-
- int n;
- double a, b, c;
- char buffer[256];
- ReadFile(InputFile, buffer, 256, &n, NULL);
- CloseHandle(InputFile);
- sscanf(buffer, "%lf %lf %lf", &a, &b, &c);
- char cmdArgs[200];
- snprintf(cmdArgs, sizeof(cmdArgs),"%lf %lf %lf",a, b, c);
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
- ZeroMemory(&pi, sizeof(pi));
-
- if(!CreateProcessA("D:\\Bolshakov41p\\Processes\\x64\\Debug\\Processes.exe",
- cmdArgs,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi))
- {
- printf("Íå óäàëîñü ñîçäàòü ïðîöåññ. Êîä îøèáêè: %d.\n", GetLastError());
- }
- WaitForSingleObject(pi.hProcess, INFINITE);
- DWORD childExitCode;
- GetExitCodeProcess(pi.hProcess, &childExitCode);
- CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
- }
|