Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <windows.h>
- const char nome[]="\\\\.\\pipe\\pippo";
- int main(int argc, char *argv[])
- {
- HANDLE hpipe;
- BOOL bRet;
- DWORD size;
- hpipe = CreateFile(nome,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL);
- if(hpipe==INVALID_HANDLE_VALUE)
- {printf("Errore apertura file: %d\n",GetLastError());}
- while(1)
- {
- char messaggio [100];
- bRet = ReadFile(hpipe,messaggio,100,&size,NULL);
- if(bRet==FALSE)
- {
- printf("Lettura fallita: letti %u byte.\n",size);
- break;
- }
- printf("Ricevuto dal server: %s\n",messaggio);
- Sleep(500);
- }
- CloseHandle(hpipe);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement