![]() |
|
#1
|
|||
|
|||
dot on colored screenI'm teaching myself C++, and I am having trouble making the screen all one color. I've tried every combination of pointers that I could think of to no use. What is the correct code? Heres my problem:
CPP / C++ / C Code:
[EDIT] These are the exact errors: Error E2034 pixel.cpp 32: Cannot convert 'int' to 'void *' in function cls(unsigned char) Error E2342 pixel.cpp 32: Type mismatch in parameter '__s' (wanted 'void *', got 'int') in function cls(unsigned char) [/EDIT] |
|
#2
|
||||
|
||||
|
Hi ambeco.
I can help you with your error codes, but not your application. Basically in C/C++ you may need to use typecasting at times to tell the function what it is you are passing. The memset function is defined as: CPP / C++ / C Code:
CPP / C++ / C Code:
This will tell the compiler that this is actually an address and not just an integer. Now, on to your application. Have you considered looking at conio.h or a similar library. I am impressed by your agressiveness and thought process in doing this. But unless you are extremely sure of what you are doing, I think memset could be a little dangerous. |
|
#3
|
|||
|
|||
Thanks!Thanks for the code dsmith! You gave me what I needed, I'm doing fine with the rest of the coding, so far. If I have more problems, I will post them, but I think that was the last thing. Thanks so much!
|
|
#4
|
|||
|
|||
|
I'm not sure what happened, but my program crashed.
CPP / C++ / C Code:
|
|
#5
|
||||
|
||||
|
Ambeco,
I may not be able to help much. I haven't screwed around with dos interrupts since the early 90's. You should let us know what compiler/OS you are using as well. Is geninterrupt a function that you have written? Is it linked from an external source? Obviosly the linker isn't complaining so the function is somewhere. Once again, I am all for writing your own low-level libraries, but have you had a chance to look at the conio library and whether your compiler includes it? |
|
#6
|
||||
|
||||
|
What OS are you using? If you are using DOS, the address of the screen is 0xB000 for mono, 0xB800 for graphics.
If Windows Xp/NT/2K, I don't believe you have direct access to the screen. From a console window though the mono screen is available. I don't know if you can get to the graphics screen or not. |
|
#7
|
|||
|
|||
|
I'm using the Borland Compiler in WinXP Pro, and I got the code from http://www.cprogramming.com/tutorial/tut1.html by Denthor of ASPHYXIA. This is beginning to seem overly complicated, as well as not working. So, how do I learn how to use a header file (say... conio) I looked through it, and it doesnt not make sense to me. Is there a place on the net that has usages of common C++ commands that you know of? Or how do I learn? Because that way I could learn how to use other ones that came with the compiler as well. Thanks!
|
|
#8
|
||||
|
||||
|
Hi ambeco.
I followed the link that you gave and it contains some really good code, but it is really geared towards the DOS environment. Like WaltP says, you don't have direct access to the screen in XP and your program is probably being prohibited from writing to that memory address. conio.h does alot of this type of screen processing for you and is written specifically to work with your OS. For your application it is going to work with XP in a console window. As far as learning more about it there are several things you can do.
I hope this gets you going... |
|
#9
|
||||
|
||||
|
Quote:
Which compiler version are you using? If it's not 5.5 you probably have a help file that describes the functions in conio.h. The following functions are in conio.h (from bcb5rtl.toc) 3 Conio.h 4 clrscr=clrscr 4 delline=delline 4 getch=getch 4 getche=getche 4 getpass=getpass 4 gettext=gettext 4 gettextinfo=gettextinfo 4 gotoxy=gotoxy 4 highvideo=highvideo 4 insline=insline 4 kbhit=kbhit 4 lowvideo=lowvideo 4 movetext=movetext 4 normvideo=normvideo 4 putch=putch 4 puttext=puttext 4 _setcursortype=_setcursortype 4 textattr=textattr 4 textbackground=textbackground 4 textcolor=textcolor 4 textmode=textmode 4 wherex=wherex 4 wherey=wherey 4 window=window The help file bcb5rtl.hlp documents the functions. I found the help file hidden on the Borland site. If I can find the link I'll post it. |
|
#10
|
||||
|
||||
|
Link to documentation for Borland 5.02 and 5.5
http://info.borland.com/techpubs/borlandcpp/ |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| nvidia fx5200 128mb black screen!! | cpu-loser | Computer Hardware Forum | 32 | 21-Jul-2004 18:28 |
| Operation Flashpoint blank screen after mods | pcxgamer | Computer Software Forum - Games | 0 | 15-Jan-2004 10:50 |
| screen saver | rickdragon | C++ Forum | 0 | 18-Nov-2003 02:48 |
| screen resolution | zuzupus | Web Design Forum | 0 | 29-Jul-2003 02:50 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The