gnu libc function getline

Hi,

Is there any library function that’s similar to GNU c library “getline” function?

Thanks!
Yicheng

c=getchar();
while(c != ‘\n’){
buffer=c;
buffer++;
c=getchar();
}
fflush(stdin);

^^

Nah, getline() can grow the buffer as needed. In the while loop you need to add a check for size and grow the buffer is needed ( with realloc ). I assume it would be simple to find getline’s source code on the net and port that to QNX.

If I may, it’s a good habit to use ++buffer instead of buffer++. In this particular case it makes no difference, but in C++ it can add extra overhead depending on the type of the object… Post-operation requires the creation of a temporary object.