Collector
پنج شنبه 17 اسفند 1391, 11:45 صبح
مشکل این تابع چی هست؟
این خطا را میده
Unhandled exception at 0x00413c04 in Program.exe: 0xC0000005: Access violation reading location 0xb8000000.
void Save_Pic()
{
char fname[80];
FILE *fp;
register int i, j;
char far *ptr = (char far *)0xB8000000;
char far *temp;
unsigned char buf[14][80];
temp = ptr;
for(i=0; i<14; i++)
for(j=0; j<80; j+=2)
{
buf[i][j] = *temp;
buf[i][j+1] = *(temp + 8152);
*temp = 0;
*(temp + 8152) = 0;
temp++;
}
//gotoxy(0, 0);
printf("Enter File Name For Put: ");
gets(fname);
fp = fopen(fname, "wb");
if(fp == NULL)
{
printf("Cannot Open File.Press a key... ");
getch();
return;
}
temp = ptr;
for(i=0; i<14; i++)
for(j=0; j<80; j+=2)
{
*temp = buf[i][j];
*(temp + 8152) = buf[i][j+1];
temp++;
}
for(i=0; i<8152;i++)
{
putc(*ptr, fp);
putc(*(ptr + 8152), fp);
ptr++;
}
fclose(fp);
}
این خطا را میده
Unhandled exception at 0x00413c04 in Program.exe: 0xC0000005: Access violation reading location 0xb8000000.
void Save_Pic()
{
char fname[80];
FILE *fp;
register int i, j;
char far *ptr = (char far *)0xB8000000;
char far *temp;
unsigned char buf[14][80];
temp = ptr;
for(i=0; i<14; i++)
for(j=0; j<80; j+=2)
{
buf[i][j] = *temp;
buf[i][j+1] = *(temp + 8152);
*temp = 0;
*(temp + 8152) = 0;
temp++;
}
//gotoxy(0, 0);
printf("Enter File Name For Put: ");
gets(fname);
fp = fopen(fname, "wb");
if(fp == NULL)
{
printf("Cannot Open File.Press a key... ");
getch();
return;
}
temp = ptr;
for(i=0; i<14; i++)
for(j=0; j<80; j+=2)
{
*temp = buf[i][j];
*(temp + 8152) = buf[i][j+1];
temp++;
}
for(i=0; i<8152;i++)
{
putc(*ptr, fp);
putc(*(ptr + 8152), fp);
ptr++;
}
fclose(fp);
}