3 ms·
I use a lib like this, but a few changes. printf("The string is %"PRIstr"\n", PRIstrarg(mystring)); Simpler: printf("the string is : %.*s",mystr.size, mys
by habibur 4y ago
I use a lib like this, but a few changes.
printf("The string is %"PRIstr"\n", PRIstrarg(mystring));
Simpler: printf("the string is : %.*s",mystr.size, mystr.data)
But that's tedious to write. So create a small macro
#define ls(x) (x).size,(x).data
And then printf becomes as simple as :
printf("the string is : %.*s", ls(mystr));
Though OP's macro is possibly doing more.