Re: write
- From: Bill Waddington <william.waddington@xxxxxxxxxx>
- Date: Mon, 28 Apr 2008 17:06:55 -0700
On Mon, 28 Apr 2008 00:39:28 GMT, "Bill Cunningham" <nospam@xxxxxxxxx>
wrote:
"Bill Waddington" <william.waddington@xxxxxxxxxx> wrote in message
news:c75a149109g74qhdr6tiqd9i9jkh61jvaq@xxxxxxxxxx
What does file say if you call write thusly:
if((t=write(file,buf,7))==-1) {
Just curious,
Bill
Just like I thought. Just enough space for the string "string\0" String
and the terminating \0. I changed it to strlen though.
But what kind of file does the file utility think it is?
My (implied) point was that you were writing more than just your
text string by passing in a byte count larger than your string.
You were writing the string plus whatever followed it in memory.
Depending on the additional stuff you wrote, file may well
have decided that it _wasn't_ a text file. It may be that
including the \0 at the end of your string will also cause
file to decide that it's a data file rather than a text file.
AFAIK, file just looks at the _contents_ of a file and takes
its best shot at determining what it is.
I guess I'm missing what you are really trying to do here...
Bill
--
William D Waddington
william.waddington@xxxxxxxxxx
"Even bugs...are unexpected signposts on
the long road of creativity..." - Ken Burtch
.
- References:
- Prev by Date: Re: call insmod in C program
- Next by Date: Re: write
- Previous by thread: Re: write
- Next by thread: Re: write
- Index(es):
Relevant Pages
|