MEMORY.C
资源名称:MSDN_VC98.zip [点击查看]
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:1k
源码类别:
Windows编程
开发平台:
Visual C++
- /****************************************************************************
- * 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;
- }