Unless it's opened with Win32 API SPARSEFILE flag, yes it will grind away.
Tyler MacDonald wrote:
On my linux system, the following test code instantaniously creates a 1
gigabyte file... I'm guessing on Win32 it will either:
1) Grind away for 5 minutes creating a file full of zeroes,
2) Not work at all, or
3) If I'm really lucky, have the same behaviour as on linux.
Test code attached... would anybody with access to a win32 box be able to
give it a try and let me know what happened? (And specify if they're using
cygwin, visual studio, or whatever?)
Thanks,
Tyler
------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <apr.h>
#include <apr_pools.h>
#include <apr_file_io.h>
#if APR_MAJOR_VERSION == 0
#define APR_FOPEN_READ APR_READ
#define APR_FOPEN_WRITE APR_WRITE
#define APR_FPROT_OS_DEFAULT APR_OS_DEFAULT
#endif
int main (int argc, const char* const* argv) {
apr_pool_t *pool;
apr_file_t *f;
apr_off_t offs;
int ret;
if(apr_app_initialize(&argc, &argv, NULL) != APR_SUCCESS) {
fprintf(stderr, "apr_app_initialize() failed!\n");
fflush(stderr);
exit(20);
}
atexit(apr_terminate);
if(apr_pool_initialize() != APR_SUCCESS) {
fprintf(stderr, "apr_pool_initialize() failed!\n");
fflush(stderr);
exit(2);
}
if(apr_pool_create(&pool, NULL) != APR_SUCCESS) {
fprintf(stderr, "apr_pool_create() failed!\n");
fflush(stderr);
exit(3);
}
apr_file_open(
&f, "test-sparse",
APR_READ | APR_WRITE | APR_CREATE, APR_FPROT_OS_DEFAULT,
pool
);
offs = 1048576000;
apr_file_seek(f, APR_SET, &offs);
apr_file_putc('x', f);
apr_file_close(f);
exit(0);
}