∨
在调用int getwidth(int fp) 或者int getheight( int fp)后 函数中的变量值 发生了改变??????????
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
int change()
{
printf("\nnumber change!\n");
return 55;
}
int open64kfile(char *filename)
{
int fp;
if((fp = open(filename, O_RDONLY | O_BINARY)) == -1)
{
printf("Can't find file ""%s"".",filename);
getch();
return 0;
}
return fp;
}
int getwidth(int fp)
{
int WIDTH;
lseek(fp, 18, SEEK_SET);
read(fp, &WIDTH, 4);
return WIDTH;
}
int getheight( int fp)
{
int HEIGHT;
lseek(fp, 22, SEEK_SET);
read(fp, &HEIGHT, 4);
return HEIGHT;
}
int outquestion(int a,int b,int c)
{
int fp;
printf("a=%d,b=%d,c=%d",a,b,c);
getheight(fp=open64kfile("end.bmp"));
change();
printf("a=%d,b=%d,c=%d",a,b,c);/*变量值怎么变拉?*/
close(fp);
}
main()
{
int a=1,b=2,c=3;
outquestion(a,b,c);
getch();
}
/*---------------------------------------------------------------------------------------*/
程序运行后在调用int getwidth(int fp) 或者int getheight( int fp)后无原无故的 需要键盘输入??
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
typedef struct {
int fp;
int WIDTH;
int HEIGHT;
int fix;
int outx;
int outy;
int file_x1;
int file_y1;
int file_x2;
int file_y2;
int lucency;
}BmpFile;
int open64kfile(char *filename)
{
int fp;
if((fp = open(filename, O_RDONLY | O_BINARY)) == -1)
{
printf("Can't find file ""%s"".",filename);
getch();
return 0;
}
return fp;
}
int getwidth(int fp)
{
int WIDTH;
lseek(fp, 18, SEEK_SET);
read(fp, &WIDTH, 4);
return WIDTH;
}
int getheight( int fp)
{
int HEIGHT;
lseek(fp, 22, SEEK_SET);
read(fp, &HEIGHT, 4);
return HEIGHT;
}
main()
{
BmpFile partview;
partview.fp=open64kfile("end.bmp");
getheight(partview.fp);/*这里为什么需要键盘输入?
但是把#include <io.h>去掉就不用拉??????????*/
printf("skdfd");
getch();
}