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

📄 clnpipe.cpp

📁 这是c++编程方面的名著的例子代码
💻 CPP
字号:
// This is a client process that
// uses named pipes to perform
// interprocess communication with npipe.exe

#define INCL_DOSQUEUES
#include <os2.h>
#include <fstream.h>
#include <string.h>



char PipeName[40] = "";
HFILE PipeHandle, PipeOut;
unsigned long NumBytesRead;
unsigned long Action;
char Buffer1[2] ="";
char Buffer2[2] = "";


void main(void)
{

    strcpy(PipeName,"\\PIPE\\PIPE1");
    DosOpen(PipeName,&PipeHandle,&Action,0,FILE_NORMAL,FILE_OPEN,
	    OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE,(PEAOP) NULL);
    DosRead(PipeHandle,Buffer1,1,&NumBytesRead);
    DosRead(PipeHandle,Buffer2,1,&NumBytesRead);
    cout << "Client Read " << Buffer1 << " " << Buffer2 << endl;
    DosWrite(PipeHandle,Buffer1,1,&NumBytesRead);
    DosWrite(PipeHandle,Buffer2,1,&NumBytesRead);


}

⌨️ 快捷键说明

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