summaryrefslogtreecommitdiff
path: root/examples/chat
diff options
context:
space:
mode:
Diffstat (limited to 'examples/chat')
-rw-r--r--examples/chat/prompt.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/chat/prompt.cpp b/examples/chat/prompt.cpp
index 6132d63..72b0195 100644
--- a/examples/chat/prompt.cpp
+++ b/examples/chat/prompt.cpp
@@ -42,7 +42,12 @@ int main (int argc, const char *argv [])
// Prepare a message buffer. Place username at the beginning
// of the message.
char textbuf [1024];
+#ifdef _MSC_VER
+ _snprintf_s (textbuf, sizeof (textbuf), sizeof (textbuf), "%s: ",
+ username);
+#else
snprintf (textbuf, sizeof (textbuf), "%s: ", username);
+#endif
size_t prefixsz = strlen (textbuf);
char *text = textbuf + prefixsz;