Trim trailing spaces as well

This commit is contained in:
Utkarsh Verma 2021-12-30 11:03:42 +05:30
parent 172a239edb
commit 97ec586b82
No known key found for this signature in database
GPG Key ID: 817656CF818EFCCC
1 changed files with 6 additions and 1 deletions

7
main.c
View File

@ -99,7 +99,12 @@ void updateBlock(int i) {
int j = bytesRead - 1;
while ((buffer[j] & 0b11000000) == 0x80)
j--;
buffer[j] = '\0';
buffer[j] = ' ';
// Trim trailing spaces
while (buffer[j] == ' ')
j--;
buffer[j + 1] = '\0';
if (bytesRead == LEN(buffer)) {
// Clear the pipe