Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wrote my own sprintf handler which checks string length and truncates if necessary.

unsigned long lsprintf(unsigned long max_length,char [asterisk]dest,char [asterisk]fmt, ...)

char buffer[1024];

lsprintf(1024,buffer,format);

Slightly overkill.



C99 has snprintf() for this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: