I use Turbo c++ 3.0 as well as CodeBlocks compiler/IDE on Windows 7 32 - bit OS.
I want to create a text button as it is in the Turbo c++ 3.0 IDE (if anyone has ever ised it)
I dont want to create a button as it appears in a windows application nor do i want to use windows.h.
I have written this code in the turbo c++ ide.
But as soon as the program execution (or rather the getch() ) is over an error occurs.
Error :
The NTVDM COU has encountered an illegal instruction.
CS : 8e14 IP:69f2 OP:ff ff eb 05ea
This is not legal C++. Were it legal, it would indicate a zero-sized array and writing to it would trash memory that you do not own. Supply a size (in the form of a compile time constant) for your array, and do not exceed it.
Which is the illegal part of the program ? (if u are talking about the textcolor() and all those functions, they are in the conio.h )
Even if i remove those functions and supply a size to the array i doesnt work.
The portion of code I included in my post so it would be clear what I was referring to. You are also using caption as a c-string without observing the conventions for using one. A c-string is terminated with a nul character.
actually the program does execute (it does otput the button or just the text on the screen ) and the showbutton() works well but the problem occurs when the user presses a key in response to the getch()
I used char caption[25]and it works pretty well. But a new problem has arised, when i declare new object button open; and set its caption as "open" the program actually catenates the caption of both objects and displays it. Please help me. Also when i tried file.caption = "file"; it says Lvalue required. Help me rectify the error.
thank you coder777 i had really forgotten about the strcpy function. And i do know that getcaption is actually setting the caption. The code is working properly now.