I get a ton of errors in cstdio when I add #include <cstdio>
to the C program.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2143: syntax error : missing '{' before ':'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\cstdio(17) : error C2059: syntax error : ':'
Thanks
EDIT - I would like to use snprintf, which is why I am trying to include this.
You want
#include <stdio.h>
.cstdio
is the C++ wrapper for the C header.Edit: MSVC only supports the elements in C99 that form a subset of C++.
This site has a C implementation of
snprintf()
licensed under the GPL.With Visual Studio, I believe you have to use sprintf_s or something similar. See this. There's also vsnprintf.
MSVC offers the
_snprintf
function instdio.h
.If you prefer not to use the leading underscore, you can:
This is a C library function, not specifically related to C++ (although you can use it there too).