A multithreaded C++ application for rapidly creating large files on Windows systems. This tool uses Windows API functions to efficiently create sparse files of 1GB each.
- Multithreaded file creation: Creates multiple files concurrently for improved performance
- Large file support: Each file is created with a size of 1GB (1,073,741,824 bytes)
- Performance timing: Built-in timer to measure execution time
- Flexible operation modes: Create a specific number of files or run indefinitely
- Custom naming: User-defined file naming with automatic numbering
- Platform: Windows (uses Windows API)
- Compiler: C++17 compatible compiler (Visual Studio, MinGW, etc.)
- Dependencies: Windows.h for file operations
-
Compile the project:
build.bat
-
Run the executable:
bin/FileCreator.exe -
Follow the prompts:
- Enter number: Specify how many files to create (enter 0 for infinite mode)
- Enter file name: Provide a base name for the files
-
Output:
- Files will be created in the current directory
- Files are named as:
[filename][number].dat - Execution time is displayed upon completion
Enter number: 5
Enter file name: testfile
Created: testfile0.dat
Created: testfile1.dat
Created: testfile2.dat
Created: testfile3.dat
Created: testfile4.dat
Done! Time: 0.342
This creates 5 files named testfile0.dat through testfile4.dat, each 1GB in size.
The application uses the Windows API's sparse file creation technique:
- Creates a file handle with
CreateFileA() - Sets the file pointer to 1GB using
SetFilePointerEx() - Sets the end of file marker with
SetEndOfFile() - The OS creates a sparse file without writing actual data
This method is extremely fast as it doesn't write actual data to disk, just reserves the space.
- Disk Space: Each file reserves 1GB. Ensure sufficient disk space before running
- Infinite Mode: Setting number to 0 will create files indefinitely until manually stopped or disk space is exhausted
- File Overwriting: Files with the same name will be overwritten without warning
- Platform Specific: This code only works on Windows due to Windows API usage
- Testing disk performance
- Simulating large file operations
- Stress testing storage systems
- Creating placeholder files for testing applications
- Benchmarking multithreaded file I/O