Alternative for getline() function in AIX 5.3
Shlomi Fish
shlomif at iglu.org.il
Tue Jul 27 14:02:12 IDT 2010
On Tuesday 27 Jul 2010 13:15:13 Israel Shikler wrote:
> 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.
>
Will fgets be OK enough?
http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html
Regards,
Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy
God considered inflicting XSLT as the tenth plague of Egypt, but then
decided against it because he thought it would be too evil.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
More information about the Linux-il
mailing list