Home > Archive > Unix Programming > September 2004 > cutting file by fwrite() EOF ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
cutting file by fwrite() EOF ?
|
|
| vertigo 2004-09-28, 9:04 am |
| Hello
I wanted to cut file, so i:
int *data=(int*)malloc(sizeof(int));
data[0]=EOF;
fs (file,new_size,SEEK_SET);
fwrite((void*)data,sizeof(int),1,file);
but this does not work. Why ? How can i cut file ?
Thanx
Michal
| |
| Måns Rullgård 2004-09-28, 9:04 am |
| vertigo <ax178@wp.pl> writes:
> Hello
> I wanted to cut file, so i:
>
> int *data=(int*)malloc(sizeof(int));
> data[0]=EOF;
> fs (file,new_size,SEEK_SET);
> fwrite((void*)data,sizeof(int),1,file);
>
> but this does not work. Why ? How can i cut file ?
man truncate
man ftruncate
--
Måns Rullgård
mru@mru.ath.cx
|
|
|
|
|