Created
February 6, 2024 12:06
-
-
Save GrenderG/13501484e9ff06fcef5edab840fbb4da to your computer and use it in GitHub Desktop.
Revisions
-
GrenderG created this gist
Feb 6, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ void print_log(const char *__s) { size_t max_length = 19; char __trimmed[20]; // 19 characters + 1 for null terminator. size_t len = strlen(__s); size_t i; // Copy characters up to max_length or until the end of the string. for (i = 0; i < max_length && i < len; ++i) { __trimmed[i] = __s[i]; } // Fill the remaining space with empty spaces. for (; i < max_length; ++i) { __trimmed[i] = ' '; } // Null-terminate the string. __trimmed[max_length] = '\0'; // Reset cursor position. gotoxy(1, 16); printf("%s", __trimmed); }