由买买提看人间百态

topics

全部话题 - 话题: filelength
(共0页)
c***0
发帖数: 449
1
来自主题: JobHunting版 - 请教一道FB面试题
你看看这个行不行。
void tail(char* file, int fileLength, int n){
int subfileLength;
int fileIndex;
if (n == 0) return;
if (fileLength > memorySize){
subfileLength = roundup(fileLength/memorySize);
fileIndex = memorySize - roundup(n/subfileLength);
file = file + fileIndex * subfileLength;
tail(file, subfileLength, n%subfileLength);
displayfromIndex(fileIndex + 1);
}
else
displayLastNLines();
}
S****t
发帖数: 1186
2
来自主题: Programming版 - size of structure
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
来自主题: Unix版 - bsplit.c
/* 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
(共0页)