| 289 | | |
| 290 | | {{{ |
| 291 | | void Print(const std::string& fmt, ...); |
| 292 | | void Print(const char * fmt, va_list& args); |
| 293 | | void Print(const std::string& fmt, va_list& args); |
| 294 | | void Print(const char * fmt, va_list& args); |
| | 289 | Outputs text which may include format specifiers. For each format specifier an additional parameter must be provided. |
| | 290 | {{{ |
| | 291 | void Print(const string& strFormat, ...); |
| | 292 | void Print(const char* pszFormat, ...); |
| | 293 | void Print(const string& strFormat, va_list& args); |
| | 294 | void Print(const char* pszFormat, va_list& args); |
| | 295 | }}} |
| | 296 | |
| | 297 | ==== Parameters ==== |
| | 298 | |
| | 299 | * strFormat - string to output, may include format specifiers such as C printf statements |
| | 300 | * pszFormat - pointer to null-terminated string to output, may include format specifiers |
| | 301 | * ... - variable list of arguments that should match up with format specifiers |
| | 302 | * args - variable list of aguments structure |
| | 303 | |
| | 304 | ==== Return Value ==== |
| | 305 | |
| | 306 | Function does not return a value. |
| | 307 | |
| | 308 | ==== Remarks ==== |
| | 309 | |
| | 310 | ==== Examples ==== |
| | 311 | {{{ |
| | 312 | string str = "Hello World\r\n"; |
| | 313 | file.Print(str); |
| | 314 | }}} |
| | 315 | |
| | 316 | {{{ |
| | 317 | int n = 5; |
| | 318 | string str = "ABC"; |
| | 319 | file.Print("Number: %d String %s\r\n", n, str.c_str()); |
| | 320 | }}} |
| | 321 | |
| | 322 | {{{ |
| | 323 | // This is a function to log update data to two devices |
| | 324 | // g_fileLog1, and g_fileLog2 are globals that should already have been opened before this function is called. |
| | 325 | void LogOutput(const char* fmt, ...) |
| | 326 | { |
| | 327 | va_list args; |
| | 328 | va_start(args, fmt); |
| | 329 | |
| | 330 | g_fileLog1.Print(fmt, args); |
| | 331 | g_fileLog2.Print(fmt, args); |
| | 332 | } |
| | 333 | |