Jump to content
  • Advertisement
Sign in to follow this  
TheFlea

ANSi Driver -inC++

This topic is 4435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I use windows Xp and I want to use the driver ANsi;In "c:\windows\system32\config.nt" and there , in config.nt I wrote device=c:\windows\system32\ansi.sys . I restart my computer and I try to use Ansi colors; This is the code
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
void main ()
{int a,b;
printf("\033[31m");
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"Suma este..."<<a+b<<endl;
getch();} // he want to return a color Red but he doesn't work... I need help... see u.

Share this post


Link to post
Share on other sites
Advertisement
You should be using the line #include <iostream> and not #include <iostream.h>
I can't see any other problems; why are you using getch() at the end?

Share this post


Link to post
Share on other sites
Quote:
Original post by programwizard
You should be using the line #include <iostream> and not #include <iostream.h>
I can't see any other problems; why are you using getch() at the end?


And cstdio and cconio.

How does it "not work"?

Share this post


Link to post
Share on other sites
DukeAtreides076 this point I i write now ...but i don't know hwo to use ... Sertextatributte
:(( ...if u can help me ...

Share this post


Link to post
Share on other sites
Quote:
Original post by TheFlea
DukeAtreides076 this point I i write now ...but i don't know hwo to use ... Sertextatributte
:(( ...if u can help me ...

If you want to change color, use SCTA like this:


enum COLOR_ENUM
{
BLACK,
BLUE,
GREEN,
AQUA,
RED,
PURPLE,
YELLOW,
WHITE,
GRAY,
LIGHT_BLUE,
LIGHT_GREEN,
LIGHT_AQUA,
LIGHT_RED,
LIGHT_PURPLE,
LIGHT_YELLOW,
BRIGHT_WHITE
};

...

//Before you write text, call SCTA like this:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), LIGHT_GREEN);




This is easier to use if you use a stream manipulator.

P.S.
Don't forget to restore the original text color.

Share this post


Link to post
Share on other sites
Thank you a lot, this is the great place, because in other forum if I do this question I don't give any help (sorry for my english :) )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!