Below you will find pages that utilize the taxonomy term “String”
February 17, 2016
Limit String Length in Printf in C
I can’t believe how many times I forget this trick! so I am writing it down so I won’t forget it!
Normally when you use printf function with “%s” formatting to print a string (char *) you rely on C convention of terminating a string with a NULL character (i.e. value 0).
So if you want to print small part of longer string, you copy the part you need to a new buffer and terminate it will NULL.