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 __stosw.

Microsoft Specific**

Generates a store string instruction (rep stosw).


void __stosw(   
   unsigned short* Dest,   
   unsigned short 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 words to write.


Intrinsic Architecture
__stosw x86, x64

Header file <intrin.h>


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

This routine is only available as an intrinsic.


// stosw.c  
// processor: x86, x64  
#include <stdio.h>  
#include <intrin.h>  
#pragma intrinsic(__stosw)  
int main()  
    unsigned short val = 128;  
    unsigned short a[100];  
    memset(a, 0, sizeof(a));  
    __stosw(a+10, val, 2);  
    printf_s("%u %u %u %u", a[9], a[10], a[11], a[12]);     
0 128 128 0  

END Microsoft Specific

See Also

Compiler Intrinsics