write
- From: "Bill Cunningham" <nospam@xxxxxxxxx>
- Date: Sun, 27 Apr 2008 21:04:36 GMT
I tried to write with this call and I don't know what happened. I really
don't know much about it.
Here's my code -
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main (void) {
int file;
char buf[]="hello world\n";
size_t c;
c=20000;
write(file,buf,c);
}
Now there must be a call somewhere that C compilers call when using
fopen. This call didn't open anything for me. Also this call must only write
binary and not text. I ran this code it compiled great and did nothing
apparent. So I used dd to write zeros to a file called "file". An empty
file. Then I ran the code and used linux's file keyword to see what type of
file it was and it was data. I used a text editor to open the file and it
didn't work.
What are the uses and limitations of write() and I assume read() is the
same. C's fopen in text mode must call another syscall.
Bill
.
- Follow-Ups:
- Re: write
- From: Lew Pitcher
- Re: write
- Prev by Date: [OT] raw-disk and cache-buffer
- Next by Date: Re: setrlimit() extension suggestion
- Previous by thread: [OT] raw-disk and cache-buffer
- Next by thread: Re: write
- Index(es):
Relevant Pages
|