소스 검색

msvc has no snprintf in stdio.h

Julius Pfrommer 9 년 전
부모
커밋
a54fdfa5bb
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      examples/networklayer_tcp.c

+ 4 - 0
examples/networklayer_tcp.c

@@ -430,7 +430,11 @@ UA_ServerNetworkLayer * ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_U
     if(gethostname(hostname, 255) == 0) {
         char discoveryUrl[256];
         UA_String str;
+#ifndef _MSVC
         str.length = snprintf(discoveryUrl, 255, "opc.tcp://%s:%d", hostname, port);
+#else
+        str.length = _snprintf(discoveryUrl, 255, "opc.tcp://%s:%d", hostname, port);
+#endif
         str.data = (UA_Byte*)discoveryUrl;
         UA_String_copy(&str, &layer->layer.discoveryUrl);
     }