[LCP]creating files with open()

Andy Zivkovic andy at zivkotech.net.au
Mon Oct 8 18:24:10 UTC 2001


Sorry for not replying earlier, I've been so busy doing work I forgot to
reply :(

Madhav M. was correct, I forgot to specify O_WRONLY. When I did that,
everything started to work. I was so busy trying to do the UDP/transfer
protocol stuff that I forgot the basics of file I/O. :(

Why do people keep saying "don't use int's, use FILEs"? As far as I know,
file descriptors (ints) are used internally by the OS, so a FILE is actually
a wrapper around a file descriptor.

Anyway, I am saving binary files, so I don't require the formatting of
fprintf, etc. I may as well use write instead of fwrite, and get to use one
less parameter that way too. But thanks for everyone's suggestions. Typical
the solution was something so easy/obvious :(

Andy

> -----Original Message-----
> From: linuxcprogramming-admin at lists.linux.org.au
> [mailto:linuxcprogramming-admin at lists.linux.org.au]On Behalf Of Andrew
> Weaver
> Sent: Monday, 8 October 2001 3:59 PM
> To: 'linuxcprogramming at lists.linux.org.au'
> Subject: RE: [LCP]creating files with open()
>
>
> First off, use FILE for the file, not int. What are your
> permissions in the
> directory you run your program and what is the umask setting?
>




More information about the linuxCprogramming mailing list