Hello world\nto the current position of the record in this ring buffer and advances the current position forward. When the pointer approaches the end of the buffer and the length of the output string is longer than available space, the string must be "broken", i.e. the beginning of the line must be at the end of the buffer, and the end of the row -- in the beginning (assuming that at the beginning already released), ie should be able to, for example:
char buf = "orld\n\0\0\0\0Hello w";to cut off the tail of the output string I can use snprintf but how can I cut off the head of the output string? And, Yes, of course, the answer in the style of "back off n bytes from the beginning of the string and print" is not suitable, because the string is not
"%s: a[%d] = %d".
Find more questions by tags C