Archive | C/C++ RSS feed for this section

Running C/C++ [old DOS programs] in Windows Vista / 7 in Fullscreen Mode

5 Jul

I’m now using Windows 7 the new Windows OS which is working fine with my PC. It was a long time i had installed Turbo C++ in my system. That was our exam times, i tried installing Turbo C++ in my system. It worked fine but only one problem is that full screen mode is disabled. My monitor is of 1440×900 resolution so that the Turbo C++ screen fit in 1/4th of the total window more than that the graphics programs are not working… because in cant initialize the graphics object. After a lot of searching i found a software it was DOSBOX. DOSBox emulates an Intel x86 PC with sound, graphics, mouse and more. DOSBox emulates a 286/386 CPU, supports realmode amd protected mode, has a full virtual file system, support for XMS and EMS, graphics support including Tandy/Hercules/CGA/EGA/VGA/VESA and sound support including SoundBlaster and Gravis Ultra Sound cards. It has excellent compatibility with many classic games.

Download DOSBOX


Bitmap Image file Validator/Checker

2 Apr

I’ve created this program as a part of a project ‘Image Enhancer’. This Program can be used to check whether the given file is a valid BMP file or not. Just compile the source code and enter the absolute file path in the prompt. (Ex-c:\test\text.bmp)

//Checking and validation of an BMP ImageFile
#define BMPTYPE (((WORD) ‘M’ << must=”=”‘BM'” ex=”c:\tc\text.bmp):” length =” strlen(inname);” i =” 0;”>= ‘a’) && (inname[i] <= ‘z’)){
inname[i] = toupper(inname[i]);
FILE *infp;
//strcpy( inname, argv[1]);
infp = fopen( inname, “r”);
if( ! infp)
printf(“\n Unable to open %s for input\n”, inname);
printf(“Try again..”);
// exit(1);
printf(“Verifying file….”);
printf(“\nPress any key to exit\n”);
// exit(0);

Enabling Multiple forms in ASP.NET

25 Mar

The ASP.NET Control/PostBack Architecture is excellent for most Web . However, there are a few limitations that can sometimes be quite significant.One of the most fundamental problems has been the restriction to one server Form. This is very annoying for me i tried different methods but none of them worked, finally i tried with the panels and worked perfectly. I’m sharing you steps for enabling multiple forms in a single page. This article is a review of solution to the problems:

Use Panels inside the form tags….

Sample Code

< id=”Form1″ method=”post” runat=”server”>
< id=”panel1″ runat=”server”>
< id=”Textbox2″ runat=”server”>Form1
< runat=”server” id=”Button1″ name=”Button1″ text=”Click to see Form2″>

< id=”panel2″ runat=”server” visible=”false”>
< id=”TextBox1″ runat=”server”>Form2
< runat=”server” id=”Button2″ name=”Button2″ text=”Click to see Form1″>

Just try it and give feedbacks…

Programming with Parallel Port LPT

24 Mar

Now i’m working on a project to create a C/C++ software for communicating to the Parallel Port [LPT1]. Here i’m giving you the source code part which can be used for Parallel Port Programming. I’m sure that this may help you in some ways for your projects. Later i found that there is a library file named ParaPin which it easy to write C code under Linux that controls individual pins on a PC parallel port. but i didnt use that coz my whole system must be changed in order to do a small program. But Parapin is really helpful file for developers.

Source Code

#define port 0x378 //data port 8pins 2,3,4,5,6,7,8,9
#define status 0x379 //status 5pins 11,10,12,13,15
#define control 0x37A //control 4pins 17,16,14,1

void main()
long int value;
int ch;
cout<<“** AD9851 Programming with LPT1 **”;
cout<<“\n1. Send values to LPT”;
cout<<“\n2. Set all data pins HIGH”;
cout<<“\n3. Set all data pins LOW”;
cout<<“\n4. Reset”;
cout<<“\n5. Exit”;
cout<<“\n Choose your entry :”;
case 1:
for(int i=0;i<5;i++)
cout<<“\nEnter W”<<<“=”;>
outport(control,0001); //clock high
cout<<“Setting Word Clock High!!!\n”;
outport(control,0010); //freq update high
cout<<“Setting Frequency Update as HIGH !!!”;
cout<<“Word Entered Successfully….”;
goto go;

case 2:
cout<<“\n Setting all data pins to high…”;
cout<<“\nPress any key to continue…”;
goto go;

case 3:
cout<<“\n Setting all data pins to low…”;
cout<<“\nPress any key to continue…”;

goto go;

case 4:
cout<<“\nResetting Complete…”;
cout<<“\nPress any key to continue…”;
goto go;

case 5: exit(0); break;
default : cout<<“\nWrong entry…”;


void checkstatus()

unsigned int far *ptradr; /* Pointer to location of Port Addresses */
unsigned int address; /* Address of Port */
int a;

ptradr=(unsigned int far *)0x00000408;

for (a = 0; a <>
address = *ptradr;
if (address == 0)
printf(“No port found for LPT%d \n”,a+1);
printf(“Address assigned to LPT%d is %Xh\n”,a+1,address);