必须包含哪些标头才能将wsprintf与MinGW一起使用

时间:2011-04-06 11:10:09

标签: c include mingw

如果我有这些包含(按此顺序),我似乎能够使用MinGW wsprintf编译调用gcc的代码:

#include <stdarg.h>
#include <wingdi.h>
#include <winuser.h>

但我觉得可能有一些“更清洁”的方法来做到这一点。也许只有一个标题包含。我通过搜索缺少符号的头文件然后逐个包含标题来到达此列表。

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

您的意思是swprintf()吗?

swprintf()在C99标准中有所描述。您需要<wchar.h>

如果wsprintfswprintf相同,您可能需要考虑使用标准功能。

       7.24.2.3  The swprintf function

       Synopsis

       [#1]

               #include <wchar.h>
               int swprintf(wchar_t * restrict s,
                       size_t n,
                       const wchar_t * restrict format, ...);

       Description

       [#2] The swprintf function is equivalent to fwprintf, except
       that  the  argument  s specifies an array of wide characters
       into which the generated output is  to  be  written,  rather
       than  written  to  a stream.  No more than n wide characters
       are written, including a terminating  null  wide  character,
       which is always added (unless n is zero).

答案 2 :(得分:0)

您的意思是标准函数swprintf吗?在这种情况下,您应该包含wchar.h

相关问题