| | |
problems writing multiple files
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
Hi
I have a problem at writing multiple files. I have this code where I write several XML files (the number of files it's dynamic). I use a loop and in Linux works fine but the problem is Windows.
For example let's say that I want to write a long essay into 1 file, Windows and Linux do it as it should be, the problem comes when I want to write that same essay (divided into 5 parts) in 5 files. Linux works fine but windows skips the first part (the first file is not written) and the remaining parts are written well.. if I want to write the essay into 10 files, the first three are not written and as the number of files grows so does the number of files not written.
Does anyone knows why could this be? Next is the part of the code where I write into the files.
I have a problem at writing multiple files. I have this code where I write several XML files (the number of files it's dynamic). I use a loop and in Linux works fine but the problem is Windows.
For example let's say that I want to write a long essay into 1 file, Windows and Linux do it as it should be, the problem comes when I want to write that same essay (divided into 5 parts) in 5 files. Linux works fine but windows skips the first part (the first file is not written) and the remaining parts are written well.. if I want to write the essay into 10 files, the first three are not written and as the number of files grows so does the number of files not written.
Does anyone knows why could this be? Next is the part of the code where I write into the files.
Perl Syntax (Toggle Plain Text)
local *FILE_X; eval { if(substr($filename, length($filename) - 4) eq '.txt') { #this does nothing yet } else { my $success = open ::FILE, "> $filename"; unless($success) { $output->Error("Can not open file: $filename"); return $False; } print ::SITEMAP $FILE_HEADER; foreach my $line (@{$self->{_set}}) { $line->WriteXML(*FILE_X{IO}); } print ::FILE $FILE_FOOTER; close ::FILE; } }; if($@) { $output->Fatal("Couldn't write out to file: $filename"); } chmod(0644, $filename);
![]() |
Similar Threads
- parsing multiple files in current directory (Perl)
- fstream Tutorial (C++)
- Writing mp3 files to data files (OS X)
- Problems running WMLScript files (Computer Science)
- Problems with linking OBJ files (C)
- I'd like to team up with another beginner (C++)
- Ideas for a new XT compatible OS... (IT Professionals' Lounge)
- How to Rename Multiple Files with Windows Explorer (Windows tips 'n' tweaks)
Other Threads in the Perl Forum
- Previous Thread: ASCII Values for the Keyboard entry
- Next Thread: Execute Unix commands from Perl script
Views: 4839 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Perl





