⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipes.cpp

📁 这是c++编程方面的名著的例子代码
💻 CPP
字号:
// This program is from Listing 5-3
// It executes the npipes.exe.
// The npipes.exe program is from Listing5-4

#define INCL_DOSQUEUES
#define INCL_DOSPROCESS
#include "mtration.h"
#include <fstream.h>


const int PipeSz = 256;
char Buffer[PipeSz] = "";
const int Sout = 1;
const int Stin = 0;
HFILE InPipe, OutPipe;

HFILE TempOut;
HFILE TempIn;
HFILE Keep;
HFILE KeepIn;
char ErrorMessage[128] = "";

RESULTCODES Result;

ULONG NumBytesRead;
ULONG NumBytes;


mt_rational Number(1,1);

void main(void)
{

     DosDupHandle(Sout,&Keep);
     DosDupHandle(Stin,&KeepIn);
     DosCreatePipe(&InPipe,&OutPipe,PipeSz);
     DosDupHandle(OutPipe,&TempOut);
     DosDupHandle(InPipe,&TempIn);
     DosExecPgm(ErrorMessage,sizeof(ErrorMessage),EXEC_ASYNC,(PSZ) NULL,
	       (PSZ) NULL,&Result,"unpipe.exe");
     DosWrite(OutPipe,"5",sizeof(int),&NumBytes);
     DosWrite(OutPipe,"4",sizeof(int),&NumBytes);
     DosDupHandle(Keep,&TempOut);
     DosRead(InPipe,Buffer,sizeof(int),&NumBytesRead);
     cout << Buffer << endl;
     DosRead(InPipe,Buffer,sizeof(int),&NumBytesRead);
     cout << Buffer << endl;
     DosClose(InPipe);
     DosClose(OutPipe);
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -