网站首页  词典首页

请输入您要查询的函数:

 

术语 stringcchgets
释义 StringCchGets
语法:
HRESULT StringCchGets( LPTSTR pszDest,
size_t cchDest
);
StringCchGets功能
StringCchGets是更换获得。大小,以字符缓冲区的目标是提供的功能,以确保不会写入StringCchGets过去这个缓冲区的末尾。它从标准输入,一个新行一行文本('\\ ?')结束输入。该行文本复制到目标缓冲区和回车与空字符替换。
注意:此功能只能用于内部。
参数
pszDest
[out]指向它接收缓冲区复制的字符。
cchDest
[in]的目标缓冲区的大小,以字符。此值必须为函数至少2成功。所允许的最大字符数,包括终止空字符,是STRSAFE_MAX_CCH。如果cchDest太小举行文本完全一致,数据被截断。
返回值
请注意,此函数返回的hresult而不是得到,它返回一个指针。我们强烈建议您使用的成功和失败宏来测试这个函数的返回值。
S_OKCharacters是从stdin读取,复制到在pszDest缓冲区,缓冲区是空终止。
STRSAFE_E_END_OF_FILEIndicates错误或最终文件的情况。使用feof或ferror,以确定哪一个已经发生。
STRSAFE_E_INVALID_PARAMETERThe在cchDest值大于允许的最大值。
STRSAFE_E_INSUFFICIENT_BUFFERThe在cchDest值为1或更少。
备注
StringCchGets提供了代码中的适当缓冲处理额外的处理。可怜的缓冲处理是牵连,许多安全问题涉及缓冲区溢出。 StringCchGets总是空终止一个非零长度目标缓冲区。
StringCchGets可以用在它的通用形式,或作为StringCchGetsA特别(为ANSI字符串)或StringCchGetsW(为Unicode字符串)。该表格使用取决于您的数据。
字符串数据String类型LiteralFunction
字符“字符串”StringCchGetsA
TCHARTEXT(“字符串”)StringCchGets
WCHARL“字符串”StringCchGetsW
StringCchGets及其ANSI和Unicode的变种替换这些功能:
得到
_getws
_getts
StringCchGets并非fgets更换。该函数不替换终止空字符换行符。
在pszDest价值不应是NULL。见StringCchGetsEx如果您需要的空字符串指针值的处理。
功能信息
Headerstrsafe.h
import libraryNone
参见
StringCbGets,StringCchGetsEx
==英文原文==StringCchGets Function
StringCchGets is a replacement for gets . The size, in characters, of the destination buffer is provided to the function to ensure that StringCchGets does not write past the end of this buffer. It retrieves one line of text from stdin, a newline ('\\n') ending the input. The line of text is copied to the destination buffer, and the carriage return is replaced with a null character.
Note This function can only be used inline.
Syntax
HRESULT StringCchGets( LPTSTR pszDest,
size_t cchDest
);
Parameters
pszDest
[out] Pointer to a buffer which receives the copied characters.
cchDest
[in] Size of the destination buffer, in characters. This value must be at least 2 for the function to succeed. The maximum number of characters allowed, including the terminating null character, is STRSAFE_MAX_CCH. If cchDest is too small to hold the full line of text, the data is truncated.
Return Value
Note that this function returns an HRESULT as opposed to gets, which returns a pointer. It is strongly recommended that you use the SUCCEEDED and FAILED macros to test the return value of this function.
S_OKCharacters were read from stdin, were copied to the buffer at pszDest, and the buffer was null-terminated.
STRSAFE_E_END_OF_FILEIndicates an error or end-of-file condition. Use feof or ferror to determine which one has occurred.
STRSAFE_E_INVALID_PARAMETERThe value in cchDest is larger than the maximum allowed value.
STRSAFE_E_INSUFFICIENT_BUFFERThe value in cchDest is 1 or less.
Remarks
StringCchGets provides additional processing for proper buffer handling in your code. Poor buffer handling is implicated in many security issues that involve buffer overruns. StringCchGets always null-terminates a non-zero-length destination buffer.
StringCchGets can be used in its generic form, or specifically as StringCchGetsA (for ANSI strings) or StringCchGetsW (for Unicode strings). The form to use is determined by your data.
String Data TypeString LiteralFunction
char"string"StringCchGetsA
TCHARTEXT("string")StringCchGets
WCHARL"string"StringCchGetsW
StringCchGets and its ANSI and Unicode variants are replacements for these functions:
gets
_getws
_getts
StringCchGets is not a replacement for fgets . That function does not replace newline characters with a terminating null character.
The value of pszDest should not be NULL. See StringCchGetsEx if you require the handling of null string pointer values.
Function Information
Headerstrsafe.h
Import libraryNone
See Also
StringCbGets , StringCchGetsEx
==原始网址==http://msdn.microsoft.com/en-us/library/ms647536(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:51