Re: Fgets is not working on linux/gcc3.2.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 10 Apr 2003 18:03:02 +0530, Ajay Bansal wrote:

> Problem was not that I _have_ to read a file somehow. Problem was.. How
> do read using fgets.  & why it bbehaves differently on Solaris/Linux
> with same compiler. 
> 
> If I open the file with "a+", the on Solaris file pointer is at the
> beginning of the file whereas on Linux it is at the end of the file. Why
> is this difference???

'a' = append, but appending makes sense only at the end of a file.
'a' without positioning the file pointer at the end of the file
would be like 'w' (writing) and would NOT append, but overwrite
(truncate) the file. 'a+' is like 'a' but also gives 'r'
read-access.

What does the manual on Solaris say about 'a' and 'a+'?

> And if some code is already written using fgets on solaris, this
> difference makes it non-portable!!!!!

Remains to be seen whether the API is non-portable or whether the
source code is.

- -- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+lXYi0iMVcrivHFQRAsznAJ9hhbIXeATOMZMriPdp2ys0O31dwwCfTZmt
g2pN3+xnSTHlZy/59bHmAQI=
=Xty9
-----END PGP SIGNATURE-----



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux