karthik
karthik

Reputation: 17842

Create file with certain size

Is there any method to create a file of desired size whenever I create a file using CreateFile().

Thanks.

Upvotes: 0

Views: 517

Answers (3)

mox
mox

Reputation: 6314

you might use, at the prompt (with admin credentials), "fsutil file createnew" followed by the file name and the desired size (in bytes)

Upvotes: 0

dley
dley

Reputation: 43

I think (in case you are sitting in front of a *nix box) you can handle this with the default low-lewel write() / fsync() APIs.

Regards, dley

Upvotes: 0

karthik
karthik

Reputation: 17842

SetEndOfFile can be used to extend or truncate a file.

Upvotes: 4

Related Questions