Advertisement
Kitomas

fstr.c

Jul 21st, 2023
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | Source Code | 0 0
  1. #include <fstr.h>
  2.  
  3.  
  4.  
  5. char fstr_[FSTR_LEN];
  6. char* fstr(const char* fmt, ...){
  7.   va_list args;
  8.   va_start(args, fmt);
  9.   vsprintf_s((char*)fstr_, FSTR_LEN-1, fmt, args);
  10.   va_end(args);
  11.   fstr_[FSTR_LEN-1]=0; //just in case
  12.   return (char*)fstr_;
  13. }
  14.  
  15.  
  16. #ifndef FSTR_NO_WCHAR
  17. wchar_t fstrw_[FSTRW_LEN];
  18. wchar_t* fstrw(const wchar_t* fmt, ...){
  19.   va_list args;
  20.   va_start(args, fmt);
  21.   vswprintf_s((wchar_t*)fstrw_, (FSTRW_LEN/sizeof(wchar_t))-1, fmt, args);
  22.   va_end(args);
  23.   fstrw_[(FSTRW_LEN/sizeof(wchar_t))-1]=0;
  24.   return (wchar_t*)fstrw_;
  25. }
  26. #endif /* FSTR_NO_WCHAR */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement