Creating large empty test file

billywiggins

Member
Feb 26, 2004
186
0
0
Can anyone point me in the direction of how to create a large file to use for testing, I want a file about a gig but just filled with 1s and 0s, no actual data, but I want it to be exactly a gig. I know this can be done, just dont know how to do it. Thanks!

ps: using windows xp
 

Smilin

Diamond Member
Mar 4, 2002
7,357
0
0
Download VPC from microsoft (~20-40 megs?) creat a 1gig virtual disk. Set it to fixed size, not expanding. Use the hard drive for your file.

You might be able to do something clever with a page file too ;)
 

Matthias99

Diamond Member
Oct 7, 2003
8,808
0
0
Originally posted by: tkotitan2
i would just write about a 10 line C program to do it.

Ditto. Just have it open() a new file, and write() 2^30 bytes of rand()[om] data in it.
 

jagec

Lifer
Apr 30, 2004
24,442
6
81
Originally posted by: Smilin
Download VPC from microsoft (~20-40 megs?) creat a 1gig virtual disk. Set it to fixed size, not expanding. Use the hard drive for your file.

You might be able to do something clever with a page file too ;)

yeah, you could probably set your page file to exactly 1 GB and then duplicate it, but Windows tends to be awfully anal about its precious "system files".
 

Titan

Golden Member
Oct 15, 1999
1,819
0
0
Originally posted by: Description
i would just write about a 10 line C program to do it.
How could that possibly take ten lines?

well, i was counting the #include statements, main, and the traditional one-brace-per-line C-style coding. There'd have to be at least one for statement, and one ifstream declaration, and the opening of the stream, and the writing to it. And we can't forget the good ole return 0; that every good programmer should put it. So if i whipped it up quick it would be like 10 lines. If you really tried, you may be able to squeeze it onto two or three, but then it depends what standard your C compiler follows.
 

jagec

Lifer
Apr 30, 2004
24,442
6
81
Originally posted by: tkotitan2
Originally posted by: Description
i would just write about a 10 line C program to do it.
How could that possibly take ten lines?

well, i was counting the #include statements, main, and the traditional one-brace-per-line C-style coding. There'd have to be at least one for statement, and one ifstream declaration, and the opening of the stream, and the writing to it. And we can't forget the good ole return 0; that every good programmer should put it. So if i whipped it up quick it would be like 10 lines. If you really tried, you may be able to squeeze it onto two or three, but then it depends what standard your C compiler follows.

yeah, just remove all unneccesary carriage returns and spaces, lol :p

talk about hard to read code...