Unix to Windows Porting Dictionary for HPC

Links

Function List

snprintf


Unix

header file: stdio.h

int snprintf(char *restrict buffer, size_t count, const char *restrict format, ...);

Windows

header file: stdio.h

int _snprintf(char *buffer, size_t count, const char *format [, argument] ...);

Purpose

This function prints formatted data to a string..

Discussion

The Windows and Unix versions of this function differ only in name and the needed header file; changing the name should be all that is required to port between the two operating systems.

There are several functions that print formatted text, based on various needs. Additionally, it is recommended to use the more secure versions, as detailed in this MSDN article.

Example of Use in Windows

For a complete example, see the linked MSDN article.

blog comments powered by Disqus