RUSES
Would you like to react to this message? Create an account in a few clicks or log in to continue.
May 2024
MonTueWedThuFriSatSun
  12345
6789101112
13141516171819
20212223242526
2728293031  

Calendar Calendar


[C++] Coloured text and background

3 posters

Go down

[C++] Coloured text and background Empty [C++] Coloured text and background

Post  lee Tue Feb 28, 2012 9:35 am

Is there a surefire way to get different coloured text on all platforms or should I write off those marks now?

Google is full of rubbishness in this area and maybe others would find a clear answer useful on here too for the cw. Anyway cheers Very Happy
lee
lee

Posts : 22
Join date : 2012-02-23

Back to top Go down

[C++] Coloured text and background Empty Re: [C++] Coloured text and background

Post  Charlie Wed Feb 29, 2012 3:16 am

I don't think C or C++ understand colours, they need external libraries. I know that in Windows you can use system() calls or include <conio.h> and format using cprintf. I'm not sure about Linux but you can't use those same commands so I don't think you can do it for the coursework I'm afraid. :/

I guess if you could detect which OS is being used you could switch between commands but that could be a lot of work. :/
Charlie
Charlie

Posts : 16
Join date : 2012-02-23

Back to top Go down

[C++] Coloured text and background Empty Re: [C++] Coloured text and background

Post  lee Thu Mar 01, 2012 4:34 am

I thought that might have been the case. No colours it is then Razz

cheers I think I saw a quick way of testing what os you had (like searching for or something similar)
lee
lee

Posts : 22
Join date : 2012-02-23

Back to top Go down

[C++] Coloured text and background Empty Re: [C++] Coloured text and background

Post  DiJuMx Fri Mar 02, 2012 9:59 am

There is a way of doing it in C++ to the console...I think you need to output the VT100 escape codes to do it...
Have an experiment with them see what you find.

DiJuMx

Posts : 7
Join date : 2012-02-29

Back to top Go down

[C++] Coloured text and background Empty Re: [C++] Coloured text and background

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum