Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 590 Bytes

2014-05-13.md

File metadata and controls

18 lines (13 loc) · 590 Bytes

Hemant

More applicable to C/C++ than Ruby. The other day, I was trying to find a way to print formatted strings of arbitrary length to a buffer. Something like sprintf. The only problem is - sprintf requires a pre-allocated buffer and hence can't be used to print strings of arbitrary size.

enter asprintf. The code goes like:

char *name;
asprintf(&name, "name is %s of age %d", "kashyap", 24);

C interpreter

Coming from Ruby, the CLI/pry/irb has spoiled us - https://www.softintegration.com/ the Ch interpreter is quite good and i liked how it worked.