Функция Truncate
Функция Truncate
truncate (файл, длина);
Усекает длину указанного файла.
Запишем в файл file.txt строку и усечем его до 15 байт:
#!/usr/bin/perl # programm 15
print "Content-type: text/html\n\n";
$string = "This is a sample file"; print "Write to file: $string
"; open (file,">file.txt"); print file $string; close file; truncate ("file.txt",15); open (file,"file.txt"); $string=; close file; print "Read from file: ",$string;
Все публикации раздела