Re: Create a file larger than 3 gb
Thanks for the help. You made some good points. Here us my original code.
I was planning to add the error checking after I got it to work. Thanks
again for the advise. Please feel free make any more comments.
DWORD dwBytesWrite, dwSize;
BOOL bWrite = TRUE;
TCHAR szData[1024];
HANDLE hFile = CreateFile("c:\\test.tmp", GENERIC_WRITE,
FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, 0);
while(bWrite == TRUE)
{
memset(szData, 0, sizeof(szData));
WriteFile(hFile, szData, sizeof(szData), &dwBytesWrite, NULL);
// Without this, the CPU gets hit hard.
Sleep(.5);
dwSize = GetFileSize(hFile, NULL);
if(dwSize >= (1024 * 1024 * 1024 * 5))
{
bWrite = FALSE;
}
}
CloseHandle(hFile);
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:duqq74151usqfdp7qcecltmbcrc6ff59m7@4ax.com...
On Tue, 15 Jul 2008 22:50:56 -0400, "CodeTestDummy"
<sharp_mind.TAKETHISOUT@email.TAKETHISOUT.msn.comm> wrote:
All,
I am having an issue create a file larger than 3 GB. I am using
CreateFile
and WriteFile. Any ideas how to crFrom ???@0x00000BA4 Thu Jul 31 09:51:45 2008
Path: text.usenetserver.com!out02b.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mail
From: phlat_a?se <phlat_a?se@b?k.on.d?.poopdek.?invalid>
Newsgroups: alt.free.newsservers
Subject: Re: Imaginery guests
Date: Thu, 31 Jul 2008 14:33:15 +1000
Organization: Patient Fortissimo Arachnids
Lines: 32
Message-ID: <g6rfc0$tmm$2@registered.motzarella.org>
References: <22ijbs.a01.19.1@news.alt.net> <Xns9AEAF2210A11Cchucknilcar@127.0.0.1> <80d4kw574j.fsf@banana.shacknet.nu> <Xns9AEB43F9AEECchucknilcar@127.0.0.1> <1ikwesj.rcw54wq0bft8N%snipe@spambin.fsnet.co.uk> <pW6kk.260123$Uf4.98674@en-nntp-08.dc1.easynews.com> <Xns9AEBE0017CDB8chucknilcar@127.0.0.1>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: feeder.motzarella.org U2FsdGVkX18NAt2hy7658dorPqEgbIdyXsLy6W1p7T97016PEGn0FZ0Gr2hODkodsAbulQNw/9828rYMg0uxNwmE/tLDViH9K0qtPts0/bfB2MgZZIej8uy3DPfL1LnW3YE9bEr0biyddC8+aNqC7Q==
X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers
NNTP-Posting-Date: Thu, 31 Jul 2008 04:34:09 +0000 (UTC)
Summary: Drama Free Zone
X-No-Archive: yes
X-Whinging-To: http://www.catb.org/~esr/faqs/smart-questions.html#not_losing [These flamers are either lamers //or// would-be psychologists]
X-Anti-Terrorist: Learn to Fly -= Doan let the bassids Thump YOU=-
X-Reclaim-Usenet: [Crash Google Groups]-http://improve-usenet.org/underlying.html
X-Newsreader: Forte` Agent v2..xx/666 [Aussie Engrish Version]
X-Auth-Sender: U2FsdGVkX1+XvKRM70crufno0mGJTc/lNiDGkmkfScu8yUl3HoFpZw==
Cancel-Lock: sha1:LcalrkNPBHah2X9UAQ+z+7z76Gg=
X-Mission-Statement: DELTREE MORONS
Xref: usenetserver.com alt.free.newsservers:268175
X-Received-Date: Thu, 31 Jul 2008 00:34:09 EDT (text.usenetserver.com)
Status: N
chuckcar <chuck@nil.car>, scribbled in: alt.free.newsservers
George G <grgg0016@googlemail.com> wrote in
news:pW6kk.260123$Uf4.98674@en-nntp-08.dc1.easynews.com:
Bloody hell, Frogs!
BLAM!
Moron. What *exactly* do you think the postfix uk means?
ummmm.. "un-kommitted".. just as the Frogs are, yes??
err.. hang on ..
/backpeddle
...not saying for a minute that ^?^ is a Frog.. or in fact
"non-committal" ,, in fact every time I see his sig I think of
Biggles.. you do know just who Biggles was.. eh, Chuck?
Well,, [short version], that lad was _very committed_,, and true
British Steel.. something which none in this World want "up
'em".. just ask Alf (Garnett)... which reminds me.. where the
fark is FC..?
Hope yer pigeons haven't turned into Barnowls, FC... and done
stole all yer porridge, and yer gonads with 'em..!
Man needs his oats :->>
cheers
pA (_|_)
--
http://www.auplaisirdeslangues.fr/biggles-spitfire-parade-p-3356.html?language=es&osCsid=ck1pa0svr412hgta0ucv5g7m90
::GetFileSizeEx(&filesize);
and then write
if(filesize.QuadPart >= (LONGLONG)1024 * (LONGLONG)1024 * (LONGLONG)1024 *
(LONGLONG)5)
break;
so you are comparing 64-bit values to 64-bit values. You simply threw
away the high-order
32 bits of the file size!
Note that if you do a break, there is no need to worry about a boolean
variable, and you
could use the while(TRUE) construct.
****
{
bWrite = FALSE;
}
}
CloseHandle(hFile);
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm