trick/trick_source/sim_services/VariableServer/VariableServerThread_write_stdio.cpp
jmpenn 2a03ff5cf4
Replace sprintf with snprintf in all of Trick source. #1384 (#1392)
* Replace sprintf with snprintf in all of Trick source. #1384

* Don't add -Werror for MacOS because of deprecated sprintf warnings which we cant get rid of because SWIG. #1384

* Fixed an unbalanced parenthesis in S_overrides.mk. #1384
2022-11-15 15:00:05 -06:00

14 lines
459 B
C++

#include "trick/VariableServer.hh"
#include "trick/variable_server_message_types.h"
#include "trick/tc_proto.h"
int Trick::VariableServerThread::write_stdio(int stream, std::string text) {
char header[16] ;
snprintf(header, sizeof(header), "%-2d %1d %8d\n" , VS_STDIO, stream , (int)text.length()) ;
tc_write(&connection , (char *) header , strlen(header)) ;
tc_write(&connection , (char *) text.c_str() , text.length()) ;
return 0 ;
}