in reply to File append not working. Any help?
Hi, I've a file which is opened for writing and then i close it. Again i open the same file for appending to its contents, but its not appending, its removing the older contents and freshly starting. Any help on whats the issue?
How do you know its not appending? Where do you check to see if its appending in your code?
This won't go to the log system("pwd");
Also,
Um, no
$tme=localtime(); my ($d,$m,$y) = (localtime)[3,4,5]; my $mdy1 = sprintf '%d-%d-%d', $d, $m+1, $y+1900; print "\nDate is:$mdy1\n"; if ($mdy1 eq "0-3-2015") {$mdy1 = "28-2-2015";} print "\nDate is:$mdy1\n";
Um, yes
#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny qw/ path /; use Time::Piece qw/ localtime /; use Data::Dump qw/ dd /; my $date = localtime()->strftime("%m-%d-%Y"); my $logprefix = "7252_Widevine_OemCrypto_Consolelog_User1"; my $logfile = $logprefix.'_'.$date.'.txt'; for my $ix ( 0 .. 3 ){ my $fh = path( $logfile )->opena_raw; print $fh "$ix\n"; close $fh; dd( path( $logfile )->slurp_raw ); } __END__ "0\n" "0\n1\n" "0\n1\n2\n" "0\n1\n2\n3\n"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File append not working. Any help?
by ramki067 (Acolyte) on Jun 09, 2015 at 08:20 UTC | |
by Anonymous Monk on Jun 09, 2015 at 09:10 UTC |