On 29 December 2011 19:27, Chris Sutcliffe wrote:
> Using the latest update to the mingw-w64 packages in Cygwin, I've run
> in to an issue where swprintf is truncating an included string.

The issue is with the new __mingw_*printf functions that were added.
Using this code:

#include <windows.h>
#include <stdio.h>

int main(void)
{
  WCHAR test[20], teststr[4096], tmp[4096];

  wcscpy(test, TEXT("test"));
  swprintf(teststr, TEXT("This is a %s"), test);
  swprintf(tmp, TEXT("%s - %d | %s - %d"), test, wcslen(test),
teststr, wcslen(teststr));

  MessageBox(GetDesktopWindow(), tmp, L"Test", MB_OK | MB_TOPMOST);

  return 0;
}

compiled via:

i686-w64-mingw32-g++ -U__USE_MINGW_ANSI_STDIO -DUNICODE test.cpp -o test

all is good.  However, if you compile the code via:

i686-w64-mingw32-g++ -D__USE_MINGW_ANSI_STDIO -DUNICODE test.cpp -o test

you will see the issue I am encountering.

Cheers,

Chris

-- 
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to