Alternative for getline() function in AIX 5.3

Alternative for getline() function in AIX 5.3

Israel Shikler softkol at netvision.net.il
Tue Jul 27 13:15:13 IDT 2010


Hi,
 
I have a C program that reads one line of text from the keyboard.
 
The original program was written 10 years ago and was compiled with cc on
AIX 4.x. 
I used the gets() function which was the only option available at the time.
 
Recently, I had to port the program to gcc on Linux, but I was confronted
with lots of segfaults.
So, I had to change the function to getline() which is much more stable and
secure.
 
However, I was asked to maintain the new version on AIX 5.3 as well. 
 
When recompiling the program on the AIX machine I was confronted with the
lack of getline() in AIX implementation of cc.
I do not have gcc on that machine, and installing it would be an option of
last resort .
 
I am looking for an alternative to getline(), that would be portable to both
Linux and AIX.
 
Please advise.
 
Thanks.
 

  Israel Shikler

  

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20100727/3dc580dc/attachment.html>


More information about the Linux-il mailing list