The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at __stosb.

Microsoft Specific**

Generates a store string instruction (rep stosb).


void __stosb(   
   unsigned char* Dest,   
   unsigned char Data,   
   size_t Count   


[out] Dest
The destination of the operation.

[in] Data
The data to store.

[in] Count
The length of the block of bytes to write.


Intrinsic Architecture
__stosb x86, x64

Header file <intrin.h>


The result is that the character Data is written into a block of Count bytes in the Dest string.

This routine is only available as an intrinsic.


// stosb.c  
// processor: x86, x64  
#include <stdio.h>  
#include <intrin.h>  
#pragma intrinsic(__stosb)  
int main()  
    unsigned char c = 0x40; /* '@' character */  
    unsigned char s[] = "*********************************";  
    printf_s("%s\n", s);  
    __stosb((unsigned char*)s+1, c, 6);  
    printf_s("%s\n", s);  

END Microsoft Specific

See Also

Compiler Intrinsics