注册 登录
编程论坛 Delphi论坛

谁能把下面的语言转为pascal

chaw899 发布于 2019-06-18 00:59, 2288 次点击
#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 1024

int main(int argc, char *argv[])
{
    if( argc < 3 )
    {
        printf("usage: %s %s/n", argv[0], "infile outfile");
        exit(1);
    }
    FILE * outfile, *infile;
    outfile = fopen(argv[2], "wb" );
    infile = fopen(argv[1], "rb");
    unsigned char buf[MAXLEN];

    if( outfile == NULL || infile == NULL )
    {
        printf("%s, %s",argv[1],"not exit/n");
        exit(1);
    }   
    int rc;
    fseek(infile,0x4b,SEEK_SET);
    while( (rc = fread(buf,sizeof(unsigned char), MAXLEN,infile)) != 0 )
    {
        fwrite( buf, sizeof( unsigned char ), rc, outfile );
}
fclose(infile);
fclose(outfile);
system("PAUSE");
return 0;
}
0 回复
1