Click here to Skip to main content
16,004,778 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: List control with "horizontal header" ? Pin
David Crow3-Jan-08 16:06
David Crow3-Jan-08 16:06 
QuestionRe: List control with "horizontal header" ? Pin
Maxwell Chen3-Jan-08 16:08
Maxwell Chen3-Jan-08 16:08 
GeneralRe: List control with "horizontal header" ? Pin
Vaclav_3-Jan-08 16:18
Vaclav_3-Jan-08 16:18 
GeneralRe: List control with "horizontal header" ? Pin
Vaclav_3-Jan-08 16:17
Vaclav_3-Jan-08 16:17 
GeneralRe: List control with "horizontal header" ? Pin
David Crow4-Jan-08 2:31
David Crow4-Jan-08 2:31 
AnswerRe: List control with "horizontal header" ? Pin
Iain Clarke, Warrior Programmer3-Jan-08 23:31
Iain Clarke, Warrior Programmer3-Jan-08 23:31 
GeneralRe: List control with "horizontal header" ? Pin
Vaclav_4-Jan-08 7:55
Vaclav_4-Jan-08 7:55 
GeneralC++ Quick Filespace Allocation Pin
x87Bliss3-Jan-08 15:22
x87Bliss3-Jan-08 15:22 
I generally use what MSDN calls CRT lowlevel file I/O functions. These are the ones defined in io.h and fcntl.h; open, lseeki64, telli64, close, etc... There doesn't seem to be a function to allocate filespace quickly. For this example I would want to create a 10MB file. If I write 10485760 \0's to the file, it will obviously make the file 10MB - however it is slow (well for LARGE files).

I did experiment by using the following code on winvista 32-bit.
<br />
char c = 0;<br />
int newfile = open("newfile", _O_WRONLY | _O_BINARY | _O_TRUNC | _O_CREAT, _S_IREAD | _S_IWRITE);<br />
lseeki64(newfile, 10485759, SEEK_SET); //seek 1 byte short of 10MB<br />
write(newfile, &c, 1); //write \0 at this 10MB position.<br />
close(newfile);<br />


This seemed to do the trick, and the resulting 10MB file was \0 filled. However, I didn't think you were allowed to seek past the end of a file with lseek. Is this behavior expected to work on all OSs, or will some have an error with the seek? Is there any better way to do it? Basically what I am trying to accomplish is telling the OS that I am going to need X amount of disk space BEFORE I start writing the actual data, without taking up much time. The files are usually around 8GB, but may be even larger than that. My goal is to minimize fragmentation and the possibility of running out of disk space unexpectedly in the middle of writing to the file.

Finally, the contents of the allocated file are unimportant and don't have to be \0 filled (i.e. garbage is ok), but will this way or an alternative guarantee \0 filling?
QuestionRe: C++ Quick Filespace Allocation Pin
David Crow3-Jan-08 15:55
David Crow3-Jan-08 15:55 
GeneralRe: C++ Quick Filespace Allocation Pin
Vaclav_3-Jan-08 16:08
Vaclav_3-Jan-08 16:08 
Generalregarding AVCODEC Pin
Girish Kumar3-Jan-08 1:01
Girish Kumar3-Jan-08 1:01 
GeneralRe: regarding AVCODEC Pin
Vaclav_3-Jan-08 16:40
Vaclav_3-Jan-08 16:40 
General[Message Deleted] Pin
Girish Kumar3-Jan-08 17:58
Girish Kumar3-Jan-08 17:58 
GeneralRe: regarding AVCODEC Pin
Vaclav_3-Jan-08 18:11
Vaclav_3-Jan-08 18:11 
GeneralRe: regarding AVCODEC Pin
Girish Kumar3-Jan-08 18:41
Girish Kumar3-Jan-08 18:41 
GeneralRe: regarding AVCODEC Pin
Girish Kumar4-Jan-08 22:07
Girish Kumar4-Jan-08 22:07 
GeneralRe: regarding AVCODEC Pin
Girish Kumar5-Jan-08 20:23
Girish Kumar5-Jan-08 20:23 
GeneralTemplate and operator Pin
Vics3-Jan-08 0:53
Vics3-Jan-08 0:53 
GeneralRe: Template and operator Pin
CPallini3-Jan-08 2:08
mveCPallini3-Jan-08 2:08 
GeneralRe: Template and operator Pin
Vics3-Jan-08 2:49
Vics3-Jan-08 2:49 
Questionhow to modify these matrix? Pin
gentleguy3-Jan-08 0:39
gentleguy3-Jan-08 0:39 
AnswerRe: how to modify these matrix? [modified] Pin
CPallini3-Jan-08 0:57
mveCPallini3-Jan-08 0:57 
QuestionRe: how to modify these matrix? Pin
David Crow3-Jan-08 2:58
David Crow3-Jan-08 2:58 
GeneralRe: how to modify these matrix? Pin
CPallini3-Jan-08 3:18
mveCPallini3-Jan-08 3:18 
GeneralRe: how to modify these matrix?[modifed 4/01/08] Pin
gentleguy3-Jan-08 14:43
gentleguy3-Jan-08 14:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.