home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Windows Gam…ming Gurus (2nd Edition)
/
Disc2.iso
/
msdn_vcb
/
samples
/
vc98
/
sdk
/
netds
/
winsock
/
nwlink
/
testlib
/
memory.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-10-05
|
1KB
|
44 lines
/****************************************************************************\
* memory.c -- sample program demonstrating NWLink.
*
* Microsoft Developer Support
* Copyright (c) 1992-1997 Microsoft Corporation
*
* Demonstrates basic sockets programming with the Windows Sockets API
* using the NWLink transport.
*
****************************************************************************/
#include <stdio.h>
#include <windows.h>
#include "externs.h"
/****************************************************************************
*
* FUNCTION: mem_check( LPSTR p, UCHAR ch, int len)
*
* PURPOSE: Makes sure that a buffer is filled with only the character
* specified.
*
* ARGUMENTS: LPSTR => buffer to scan
* char character to check for
* int length of buffer to check
*
* RETURNS: 0 if buffer has only the specified character
* offset to non-matching character if found
*
*\***************************************************************************/
int mem_check(LPSTR p, UCHAR ch, int len)
{
int buflen;
buflen = len;
while (len--) {
if ((UCHAR)*p++ != ch) {
return (buflen - len);
}
}
return 0;
}