S****t 发帖数: 1186 | 2 I have a structure defined as:
typedef struct{
char FileCodes[4], U1[4], U2[4], U3[4], U4[4], U5[4], FileLength[4];
int Version, Shape;
double Xmin, Ymin, Xmax, Ymax, Zmin, Zmax, Mmin, Mmax;
}FileHeader;
I used "sizeof(FileHeader)" to get the size of this structure. When I use gcc
in Unix environment, I get 100, which is my expectation. However, when I use
VC in Windows XP, I get 104 all the time. I am really confused about this.
Any help? Thanks. |
|
c*****t 发帖数: 1879 | 3 /* a code I wrote long time ago for this purpose */
#include
#include
#include
#include
#include
#include
#ifndef true
#define true 1
#define false 0
#endif
int Error (char *);
long filelength (FILE *f)
{
register long size, pos = ftell (f);
fseek (f, 0, SEEK_END);
size = ftell (f);
fseek (f, pos, SEEK_SET);
return size;
}
int writefile (FILE *infile, char *filename, long filesize)
{
FILE *outfile;
char buffer[409 |
|