|
|
1.1 root 1: /****************************************************************************\
2: * memory.c -- sample program demonstrating NWLink.
3: *
4: * Microsoft Developer Support
5: * Copyright (c) 1992, 1993 Microsoft Corporation
6: *
7: * Demonstrates basic sockets programming with the Windows Sockets API
8: * using the NWLink transport.
9: *
10: ****************************************************************************/
11: #include <stdio.h>
12: #include <winsock.h>
13: #include "externs.h"
14:
15: /****************************************************************************
16: *
17: * FUNCTION: mem_check( LPSTR p, UCHAR ch, int len)
18: *
19: * PURPOSE: Makes sure that a buffer is filled with only the character
20: * specified.
21: *
22: * ARGUMENTS: LPSTR => buffer to scan
23: * char character to check for
24: * int length of buffer to check
25: *
26: * RETURNS: 0 if buffer has only the specified character
27: * offset to non-matching character if found
28: *
29: *\***************************************************************************/
30: int mem_check(LPSTR p, UCHAR ch, int len)
31: {
32: int buflen;
33:
34: buflen = len;
35:
36: while (len--) {
37: if ((UCHAR)*p++ != ch) {
38: return (buflen - len);
39: }
40: }
41:
42: return 0;
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.