Hai.....sorry i am a little confuse with the replies given.........The source code is as below.........
#include <stdio.h>
#include <dos.h>
int main()
{
int i;
unsigned char far* scrn = (unsigned char far*) 0xb0008000;
FILE *fp = fopen("c:\\text.txt","w");
for(i=0;i<6900;i+=2)
fputc(*(scrn+i),fp);
fclose(fp);
return 0;
}
When I press Alt+F9, I get the text.txt with the information on the dos screen. Now I have tested. If I open the dos prompt and straight away type the exe Eg: C:\Scrncap.exe, I won't get the output in the c:\text.txt. The file exist but contains nothing inside. But if I open the turbo C compiler, then close it back again. And then type the exe Eg: C:\scrncap.exe, I get the output of the dos screen in the c:\text.txt. This is the part I really don't understand. Why in a newly open dos prompt I cannot capture the text in the c:\text.txt?
Added after 2 hours 50 minutes:
Hai. Thanks for the helps I receive. I found out my problem. My pc is using Win2K. Therefore I can get the result when I do the compilation in Turbo C compiler. But on the plain dos prompt I cannot get the result. I tested on a Win98 machine and it worked well. Extreme good. Therefore I would conclude that the ancient compiler is not compatible with Win2K onwards.
Problem Solved.