Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: (Hopefully) Quick and Easy C++ Question  (Read 1660 times)

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: (Hopefully) Quick and Easy C++ Question
« Reply #15 on: June 22, 2011, 03:59:00 pm »

You can use _scprintf to count the amount of buffer you need, allocate it, then use sprintf.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

McTraveller

  • Bay Watcher
    • View Profile
Re: (Hopefully) Quick and Easy C++ Question
« Reply #16 on: June 24, 2011, 08:30:04 pm »

Because sprintf is very vulnerable to buffer overruns.
There is this function called snprintf to address that very issue.

Logged
Pages: 1 [2]