简体   繁体   English

使用以指针和长度作为参数的函数写入填充字节('0')

[英]Write padding bytes ('0') with a function that takes a pointer and a length as arguments

I have a Stream object with a Write(const void *P, size_t size) function. 我有一个带有Write(const void *P, size_t size)函数的Stream对象。 I want to call it to write n Bytes of '0' . 我想称它为n字节写入'0' How would I do that without having to initialize a dummy unsigend char array with 0 and handing a pointer to the Write() function? 我如何做到这一点而不必用0初始化虚拟unsigend char数组并将指针传递给Write()函数?

您可以通过调用Write()之外的其他函数来实现此目的,该函数显然无法满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何编写一个采用不同类型参数的函数? - How to write a function which takes different type of arguments? 是否有可能编写一个函数来接受带有不同初始化的模板参数 - Is it possible to write a function which takes template arguments with different initialisations 重载的运算符将函数指针作为参数,我该如何检索函数指针的参数 - An overloaded operator takes function pointer as parameter, how do i retrieve arguments of function pointer 将成员函数指针传递给采用带有可变参数的MFP的函数时,类型不匹配 - Type mismatch when passing member function pointer to a function that takes MFP with variadic arguments 如何定义一个函数指针,该函数指针具有与给定函数相同的参数并返回值? - How can I define a function pointer that takes the same arguments and return value as a given function? Function 指针指向采用 function 指针的 function - Function pointer pointing to a function that takes a function pointer 模拟函数,参数为指针 - Mock function with arguments as pointer 指向参数减少的函数的指针 - Pointer to a function with reduced arguments 带有模板参数的函数指针 - Pointer to function with template arguments 具有默认参数的函数指针 - Pointer to function with default arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM