The getline and getwline read an entire line from stream, storing the address of the buffer, which contains the text into *lineptr. The buffer is null-terminated and includes the newline character, if one was found. If *lineptr is NULL, then getline will allocate a buffer for storing the line, which should be freed by the user program. (In this case, the value in n is ignored.) Alternatively, before calling getline, *lineptr can contain a pointer to a malloc allocated buffer n bytes in size. If the buffer is not large enough to hold the line, getline resizes it with realloc, updating *lineptr and n as necessary.