Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a 100 MB file 2

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

Running on a Windows system,how do I create a 100 MB file using Perl ?

Long live king Moshiach !
 
Just a blank file?

open(FILE,'>c:/perl/100mbfile.txt') or die $!;
print FILE ' ' x (100 * (1024 * 1024));
close FILE;


Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
:)

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
you really want to create a blank 100MB file? Why? if I may ask...
 
Does not has to be blank.
Will be used to test networking performance by ftp transfer to other hosts.
Thanks

Long live king Moshiach !
 
In that case it might be a good idea to generate random characters - any hardware or software compression on the network will make short work of a file consisting only of blanks, and might give you an artificially good result that doesn't translate to the real world.
 
lol @ mebibytes, hadn't heard that, I just get pissed when I buy a 320G hard drive, format it and get less than 300G, read the fine print and WD lovingly informs me about "decimal gigabytes". Turds.

Random data is always better to test transfer rates than homogenous. I made a 1G random file before (see perl's rand() function) to test the write failure of a RAID driver I was beta-testing.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top