Wednesday, June 15, 2011

Create a file of specified size

Windows utility "fsutil" can be used to create a file of certain size.


Fsutil file createnew

For example:

“fsutil file createnew C:\file_100MB.dat 104857600” will create a 100MB file (104,857,600B = 100MB) named “file_100MB.dat” in C drive.

Monday, June 13, 2011

Disable structure padding using pragma

Following is the way to disable structure padding using pragma in C.

#pragma pack(push, 1)
//Define your structure here
#pragma pack(pop)
//Structure padding is re enabled.

More information can be found at MSDN. GCC follows the same specifications.