SPUG: how to add text at start of a already existing file

Sachin Chaturvedi sachin_chat at coolgoose.com
Tue Jan 18 03:18:35 PST 2005

hi i want to add text at very start of already existing file.
i have tried this code but it is adding only at end

open(FH,">>" . $file)or die " can not open \n";
seek FH,0,0 ;
print FH $msg . "\n" ;
close FH or die " i can not close \n";

i had tried sysopen(FH,$file,O_APPEND|O_WRONLY)
sysseek FH,0,0
but it is doing same as said above

can any body tell me gow to add text in beginning of file.

More information about the spug-list mailing list