mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-10 14:44:32 +02:00
1.200
This commit is contained in:
parent
068b792ce6
commit
9cb7c657c7
7 changed files with 136 additions and 37 deletions
27
learn/file_string
Normal file
27
learn/file_string
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/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");
|
Loading…
Add table
Add a link
Reference in a new issue