Click here to Skip to main content
15,887,355 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: creating empty file Pin
sarfaraznawaz29-Jul-13 23:21
sarfaraznawaz29-Jul-13 23:21 
GeneralRe: creating empty file Pin
pasztorpisti29-Jul-13 23:27
pasztorpisti29-Jul-13 23:27 
GeneralRe: creating empty file Pin
sarfaraznawaz29-Jul-13 23:40
sarfaraznawaz29-Jul-13 23:40 
GeneralRe: creating empty file Pin
pasztorpisti30-Jul-13 0:12
pasztorpisti30-Jul-13 0:12 
GeneralRe: creating empty file Pin
sarfaraznawaz30-Jul-13 0:20
sarfaraznawaz30-Jul-13 0:20 
GeneralRe: creating empty file Pin
pasztorpisti30-Jul-13 0:50
pasztorpisti30-Jul-13 0:50 
GeneralRe: creating empty file Pin
jeron130-Jul-13 5:06
jeron130-Jul-13 5:06 
GeneralRe: creating empty file Pin
pasztorpisti30-Jul-13 5:43
pasztorpisti30-Jul-13 5:43 
Read the documentation of SetFilePointerEx()[^], SetEndOfFile()[^] and SetFileValidData()[^] - these are the functions you need along with CreateFile()[^] and CloseHandle()[^].

Create a file with CreateFile(), set the file pointer with SetFilePointerEx() and then call SetEndOfFile(). As a last step close the file with CloseHandle(). This is how you preallocate a file on windows. Note that the preallocated file data will be overwritten with zeros by windows in order to prevent you from reading the previous contents of the files that were stored on these sectors before deletion/moving. If you want to ask windows to skip the overwrite with zeros (for example to save time because in case of big preallocation its time consuming) then you need a few privileges and a SetFileValidData() call. Read the function documentations and use google to find out how to do that trick.
GeneralRe: creating empty file Pin
sarfaraznawaz30-Jul-13 21:24
sarfaraznawaz30-Jul-13 21:24 
AnswerRe: creating empty file Pin
Randor 30-Jul-13 21:39
professional Randor 30-Jul-13 21:39 
AnswerRe: creating empty file Pin
enhzflep30-Jul-13 2:05
enhzflep30-Jul-13 2:05 
GeneralRe: creating empty file Pin
pasztorpisti30-Jul-13 6:21
pasztorpisti30-Jul-13 6:21 
GeneralRe: creating empty file Pin
enhzflep30-Jul-13 6:46
enhzflep30-Jul-13 6:46 
GeneralRe: creating empty file Pin
pasztorpisti30-Jul-13 7:00
pasztorpisti30-Jul-13 7:00 
AnswerRe: creating empty file Pin
Erudite_Eric30-Jul-13 2:05
Erudite_Eric30-Jul-13 2:05 
GeneralRe: creating empty file Pin
Rajesh R Subramanian31-Jul-13 20:51
professionalRajesh R Subramanian31-Jul-13 20:51 
GeneralRe: creating empty file Pin
Erudite_Eric31-Jul-13 22:01
Erudite_Eric31-Jul-13 22:01 
GeneralRe: creating empty file Pin
sarfaraznawaz1-Aug-13 2:51
sarfaraznawaz1-Aug-13 2:51 
GeneralRe: creating empty file Pin
Rajesh R Subramanian1-Aug-13 6:07
professionalRajesh R Subramanian1-Aug-13 6:07 
QuestionHow to improve quality of a video.? Pin
mbatra3129-Jul-13 20:35
mbatra3129-Jul-13 20:35 
AnswerRe: How to improve quality of a video.? Pin
Erudite_Eric29-Jul-13 21:24
Erudite_Eric29-Jul-13 21:24 
GeneralRe: How to improve quality of a video.? Pin
mbatra3129-Jul-13 21:35
mbatra3129-Jul-13 21:35 
GeneralRe: How to improve quality of a video.? Pin
Erudite_Eric30-Jul-13 0:20
Erudite_Eric30-Jul-13 0:20 
GeneralRe: How to improve quality of a video.? Pin
mbatra3130-Jul-13 0:50
mbatra3130-Jul-13 0:50 
GeneralRe: How to improve quality of a video.? Pin
Erudite_Eric30-Jul-13 2:08
Erudite_Eric30-Jul-13 2:08 

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.