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);
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.