|
|
1.1 root 1:
2: /******************************************************************************\
3: * This is a part of the Microsoft Source Code Samples.
4: * Copyright (C) 1993 Microsoft Corporation.
5: * All rights reserved.
6: * This source code is only intended as a supplement to
7: * Microsoft Development Tools and/or WinHelp documentation.
8: * See these sources for detailed information regarding the
9: * Microsoft samples programs.
10: \******************************************************************************/
11:
12: ////////////////////////////////////////////////////////
13: //
14: // Client.c --
15: //
16: // This program is a command line oriented
17: // demonstration of the Simple service
18: // sample.
19: //
20: // Copyright 1993, Microsoft Corp. All Rights Reserved
21: //
22: // history:
23: //
24: // who when what
25: // --- ---- ----
26: // davidbro 2/3/93 creation
27: //
28: #include <windows.h>
29: #include <stdio.h>
30: #include <stdlib.h>
31: #include <string.h>
32:
33: VOID
34: main(int argc, char *argv[])
35: {
36: char inbuf[80];
37: char outbuf[80];
38: DWORD bytesRead;
39: BOOL ret;
40:
41: if (argc != 3) {
42: printf("usage: client <pipename> <string>\n");
43: exit(1);
44: }
45:
46: strcpy(outbuf, argv[2]);
47:
48: ret = CallNamedPipe(argv[1], outbuf, sizeof(outbuf),
49: inbuf, sizeof(inbuf),
50: &bytesRead, NMPWAIT_WAIT_FOREVER);
51:
52: if (!ret) {
53: printf("client: CallNamedPipe failed, GetLastError = %d\n",
54: GetLastError());
55: exit(1);
56: }
57:
58: printf("client: received: %s\n", inbuf);
59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.