mirror of
https://github.com/imapsync/imapsync.git
synced 2024-11-17 08:12:48 +01:00
28 lines
470 B
Perl
28 lines
470 B
Perl
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
sub file_to_string {
|
|
my($file) = @_;
|
|
my @string;
|
|
open FILE, $file or die("$! $file");
|
|
@string = <FILE>;
|
|
close FILE;
|
|
return join("", @string);
|
|
}
|
|
|
|
use Fcntl;
|
|
sub string_to_file {
|
|
my($string, $file) = @_;
|
|
sysopen(FILE, $file,O_WRONLY|O_TRUNC|O_CREAT, 0600) or die("$! $file");
|
|
print FILE $string;
|
|
close FILE;
|
|
}
|
|
|
|
|
|
|
|
|
|
string_to_file("blabla $$ \n", "/tmp/imapsync_t01");
|
|
print file_to_string("/tmp/imapsync_t01");
|
|
#unlink("/tmp/imapsync_t01");
|