Click here to Skip to main content
15,896,154 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 0:38
pasztorpisti31-Jul-13 0:38 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 1:34
002comp31-Jul-13 1:34 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 1:50
pasztorpisti31-Jul-13 1:50 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 2:23
002comp31-Jul-13 2:23 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 4:03
pasztorpisti31-Jul-13 4:03 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
002comp31-Jul-13 18:11
002comp31-Jul-13 18:11 
GeneralRe: Can we Directly write a Class Object with vectors as member into FILE ? Pin
pasztorpisti31-Jul-13 22:37
pasztorpisti31-Jul-13 22:37 
QuestionOrder of Overlapped Operations Pin
Richard Andrew x6430-Jul-13 21:58
professionalRichard Andrew x6430-Jul-13 21:58 
AnswerRe: Order of Overlapped Operations Pin
Randor 30-Jul-13 22:52
professional Randor 30-Jul-13 22:52 
GeneralRe: Order of Overlapped Operations Pin
Richard Andrew x6430-Jul-13 23:01
professionalRichard Andrew x6430-Jul-13 23:01 
AnswerRe: Order of Overlapped Operations Pin
pasztorpisti30-Jul-13 23:35
pasztorpisti30-Jul-13 23:35 
GeneralRe: Order of Overlapped Operations Pin
Richard Andrew x6431-Jul-13 7:14
professionalRichard Andrew x6431-Jul-13 7:14 
Questioncreating empty file Pin
sarfaraznawaz29-Jul-13 22:32
sarfaraznawaz29-Jul-13 22:32 
AnswerRe: creating empty file Pin
pasztorpisti29-Jul-13 22:37
pasztorpisti29-Jul-13 22:37 
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 

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.