English 中文(简体)
C中有一项调整背景说明的职能? (实际上是多斯指挥部)
原标题:There was a function in C to adjust background color? (It was actually a Dos Command)
  • 时间:2010-05-15 19:50:28
  •  标签:
  • c
  • colors

我期待着该系统的功能来调整背景图。 就像

system("color”,somecolorcodes;

是否有任何人知道?

视窗Xp或7

最佳回答

它是“第X号”的,第一个X是背景,第二个X是地下。

守则如下:

0 = Black   8 = Gray
1 = Blue    9 = Light Blue
2 = Green   A = Light Green
3 = Aqua    B = Light Aqua
4 = Red     C = Light Red
5 = Purple  D = Light Purple
6 = Yellow  E = Light Yellow
7 = White   F = Bright White

因此,对于白人的黑体字来说,你就是这样做的。

system("color 70");

仅Windows, tho。

问题回答
system("cls");  //clears the screen
system("color F0"); //Creates Bright White Background with black text
system("type struct3.c  struct2.c");  /*prints the file struct3 and struct2 in the 
                                                                             console*/

系统是一种真正有用的功能,包括在Windows.h图书馆。 显然,我们能够履行这一职能的其他许多任务,因此,当我走过这个read子时,我正在找他。

Edit:While looking at the commands in command prompt I realized that the above examples are commands in the command prompt and tried using other commands like time, help, del etc in the system() function and figured all the commands that we use in command prompt can be used by System() function. For that we write the commands in the System() function like below system("command"); Even though C is case sensitive the command inside system() is not case sensitive like in command prompt.

采取这种行动(不是监督事务司或视窗特)的更为便捷的方法是:

printf("33[%dm", 40 + color);   /* set background color */

划定原色的相应方式是:

printf("33[%dm", 30 + color);   /* set foreground color */

这些工作有:

0    black
1    red
2    green
3    yellow/brown
4    blue
5    magenta
6    cyan
7    white

这些是真正可行的,要么在您的终点站、终端播种者或青少年实施“ANSI控制序列”。

在Linot和(或)xterm下,预设90(原地)和100(背景)似乎也在工作,或许还有几组不同的彩色。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签