need help with FreeBSD!!!

I want to write to my output_file using:

if((fptr = creat(output_file, _S_IWRITE)) == -1)
return (1);
_write(fptr, buffer, BUF_SIZE);

It says "_S_IWRITE" undeclared!!!
Anybody knows what function I can use for that and what I have to include in the header files???

P.S. I #include<sys/file.h>

When I have this problem I normally go into the /usr/include or other include directories on the system and grep for the missing #define, in your case S_IWRITE. It always help to know what what compiler you are using when posting these types of C programming system questions.

BTW, nothing in the /include main dir on my linux box:

Sorry, I'm lazy to check the subdirectories and other directories (since you are on BSD and not linux... I'm just a linux basement here). Perhaps someone with BSD can grep?

[Edited by Neo on 02-27-2001 at 09:14 PM]

From the creat(2) man page:

So, it looks like you should be using open() instead.
Also, the #define you are trying to use is S_IWRITE, not _S_IWRITE. It is in sys/stat.h

I use "((ptr = creat (filename, S_IWGRP)) == -1) and it works.