see i have a program, actually a project in which there are menus whch make u go from one page to another by means of printing & using the video memory) But after the first run of the program the cursor stops displaying and the statements such as gets(string) cease to show any characters on the screen??????? i wish to know what could be causing this..........Your help or comments would be greatly appreciated..................... :)
[code]#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
1. The main entry function is declared as "int main()".
2. Do not use conio.h, it's dated, buggy, and has better alternatives.
3. This is C, not C++ which means this is the wrong forum in general (although someone may still answer you).
4. What the f$#k is going on line 32?
Good God, is that the VGA memory address I see you try to write to?
I don't think your write2screen() function will work on anything more recent than Win3.1 on 16 bits.
well i am sorry for mentioning it i havent used the function write2screen //in this sectionwell its just unneccessary for this part of my program.......................just run it more than once consecutively on ur Compiler and ullnotice that the second time we see no cursor
plz reach back thanks...
You used main() instead of int main().
You did not put a return 0; at the end of main().
My previous comment was dumb... but the fact remains that you're trying to write directly to VGA memory by using the write2screen() function in the for() at line 14.
Are you using DOS, with Borland C or DJGPP? Because most people nowadays don't.
If the problem is how you use the functions in conio.h, I doubt anyone here can help you.
I would recommend to move on to some newer compiler. All these conio.h, dos.h should just be left behind. There are a lot of free of charge compilers that you can choose. Why stick with those ones.
I cannot really help you on your program. You are using some non standard commands so you are on your own.
Also as a final advice if you want to learn c/c++ don't try this console color effects, getch() etc. Use some upto date commands and you will get your help.
@ computerquip: Good post, if he actually reads it.
Also with those nested for()'s with hard-coded limits at the beginning, he was setting the cursor position manually on a 80x50 character screen.
gotoxy(j,i); just changes the cursor position. But he didn't use cprintf correctly and given the parameters passed, it didn't seem to do anything (print spaces?). I dunno.
@computerquip - printing spaces to clear a portion of the screen
clearly stating the purpose of the code is no practical use.. i just wish to bring in notice of u worthy programmers that when i run the code for the first time all happens well:
1. first we write a string "hello" to a file new
2.Then clearing the screen save the first row and the first column.
3.Then printing hello
4.Then inputing a string into a from the user
5.Then displaying the inputted string
and between steps we use getch() to control the flow of control by the user. input through keyboard
the problem is that after running the first time , and then returning to the compiler editor(Borland) and then rerunning the output is not as expected!!!!!!!.....plz do throw siome light on this!!!! thnks
Microsoft has a program called Visual Express 2010. You can download the c++ version of that program for free.
If you want something that works via command line, I recommend GNU g++. Both of these are available for free on the internet. So please please please please do not use something outdated like Borland.
VC++ and g++ both work from command line, both have an IDE (gcc/g++ having a ton for all platforms), both have a debugger, both are awesome. I would suggest against the use of MinGW for Windows and the use of VC++. On Linux, I'd suggest the use of the GNU set while maybe using clang as a good secondary compiler for error messages.