sprintf

Determining sprintf buffer size - what's the standard?

When converting an int like so: char a[256]; sprintf(a, "%d", 132); what's the best way to determine how large a should be? I assume manually setting it is fine (as I've seen it used everywhere), but how large should it be? What's the largest int value possible on a 32 bit system, and is there some tricky way of determining that on th...

snprintf overflows and prints garbage to file randomly. help

Here is my code, basically one the 4 computer I have tested it on they all work perfectly with very large data sizes, eg textfiles up to 500mb in size, but when I run them on the server with real data even files as small as 6mb seem to overrun somewhere and writes garbage to the end of my files. Here is the source of the entire function...

sprintf() Versus mysql_query()

Having trouble formatting my code to execute without error using sprintf() When I run the code I get this error: Parse error: syntax error, unexpected T_VARIABLE in /location on line 16 $query = sprintf('UPDATE `%s` SET `stock` = :amount WHERE `itemname` = '$q'', $tablename); Above is line 16 in my code. I'm assuming it is syntax rel...