Give CharArray a printf style method to ease automatic allocation
diff --git a/win/winvnc/VNCServerService.cxx b/win/winvnc/VNCServerService.cxx
index 1a2a8e9..481df21 100644
--- a/win/winvnc/VNCServerService.cxx
+++ b/win/winvnc/VNCServerService.cxx
@@ -97,9 +97,8 @@
if (GetSessionUserTokenWin(&hToken))
{
ModuleFileName filename;
- static const char cmdLineFmt[] = "\"%s\" -noconsole -service_run";
- TCharArray cmdLine(_tcslen(filename.buf) + sizeof(cmdLineFmt)/sizeof(cmdLineFmt[0]));
- _stprintf(cmdLine.buf, cmdLineFmt, filename.buf);
+ TCharArray cmdLine;
+ cmdLine.format("\"%s\" -noconsole -service_run", filename.buf);
STARTUPINFO si;
ZeroMemory(&si, sizeof si);
si.cb = sizeof si;