Advertisement
Gamer_Z

Untitled

Feb 29th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. /*
  2.  
  3. sprintf()
  4.  
  5. PAWNO:
  6. native sprintf(const format[], {Float,_}:...);
  7.  
  8. */
  9.  
  10. #if !defined ____sprintf
  11. #define ____sprintf
  12.  
  13. #if !defined SPRINTF_MAX_STRING
  14. #define SPRINTF_MAX_STRING 4096
  15. #endif
  16. #if !defined SPRINTF_DEBUG_STRING
  17. #define SPRINTF_DEBUG_STRING "[sprintf debug] '%s'[%d]"
  18. #endif
  19.  
  20. #assert SPRINTF_MAX_STRING > 2
  21.  
  22. new
  23. _s@T[SPRINTF_MAX_STRING];
  24.  
  25. #if defined SPRINTF_DEBUG
  26. new const _s@V[] = SPRINTF_DEBUG_STRING;
  27. #define sprintf(%1) (format(_s@T, SPRINTF_MAX_STRING, %1), printf(_s@V, _s@T, strlen(_s@T)), _s@T)
  28. #else
  29. #define sprintf(%1) (format(_s@T, SPRINTF_MAX_STRING, %1), _s@T)
  30. #endif
  31.  
  32. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement