I just don't get how it works.
write(1, buffer, bytestowrite) writes to stdout.
if i open a file with open() and then do a write(2, etc..) it writes to that file.
thing is how do i know the number every time ? i don't get that :S
Name:
Anonymous2007-02-11 11:34
You have to recompile the kernel to get file pointers
Name:
Anonymous2007-02-11 12:15
man open
Given a pathname for a file, open() returns a file descriptor, a small, non-negative integer for use in subsequent system calls (read(2), write(2), lseek(2), fcntl(2), etc.). The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently open for the process.
Obviously you have to use the return value of open() as the first arg to write(). And I've never even done any serious C, I just looked at the manpage. Like you should have done.
Name:
Anonymous2007-02-11 12:42
>>3 cool man thanks for the help
the write man page didn't had that much info
Name:
Anonymous2007-02-11 13:47
>>4
You are seriously fucking stupid, and >>3 just owned you. Don't even bother trying to program if you don't even know how to look things up that you don't understand.
If successful, open() returns a non-negative integer, termed a file
descriptor. It returns -1 on failure. The file pointer used to mark the
current position within the file is set to the beginning of the file.
Name:
Anonymous2007-02-11 14:49
One word, the forced indentation of code. Thread over.
Name:
Anonymous2007-02-11 15:53
En un mot, l'indentation forcée du code. Conversation terminée.
Name:
Anonymous2007-02-11 20:03
Одним словом, вынужден отступы в код. Thread старше.
Name:
Anonymous2007-02-11 20:03
كلمة واحدة ، فقد اضطر التثليم من المدونه. على الخيط.