[Solved] How to get rid of ‘\n’ at the beginning of string


You can use standard C function memmove. For example

#include <stdio.h>
#include <string.h>

int main( void )
{
    char temp[] = "\nHello";

    if (temp[0] == '\n')
    {
        memmove(temp, temp + 1, strlen(temp));
    }

    puts(temp);
}

1

solved How to get rid of ‘\n’ at the beginning of string