2020年11月16日 星期一

[Eclipse] 修改文字及背景顏色

#ifdef
...
#endif

中間的背景顏色Inactive code highlight


---
背景顏色
General→Editor→Text Editor→Background color


---
控制台背景顏色
C/C++→Build→Console→Background color

2020年10月4日 星期日

[Linux] Kernel函式庫

Kernel

●忙碌等待(busy wait)

會占住CPU,不讓CPU處理其他事,不適合長時間使用.
#include <linux/delay.h>
void mdelay(unsigned long msecs); //毫秒
void udelay(unsigned long msecs); //微秒
void ndelay(unsigned long msecs); //奈秒


●不忙碌等待(non-busy wait)
#include <linux/delay.h>
void ssleep(unsigned int seconds);
void msleep(unsigned int mecs);
unsigned long msleep_interruptible(unsigned int mecs);


[C] 函式庫(Library)

●ASCII ->Hex
unsigned long int strtoul(const char *str, char **endptr, int base)
str: string
endptr:
base: 這是基數,2~36,或者是特殊值0。

●取絕對值
#include <stdlib.h>
int abs (int j);

●讓程式空轉以達到延遲
__NOP();

●小寫字母轉大寫
int toupper(int c);




access
http://naeilproj.blogspot.com/2015/08/linux-c-c.html


bswap_32
https://man7.org/linux/man-pages/man3/bswap.3.html


dump_stack();
#include <linux/kprobes.h>
#include <asm/traps.h>



●stroul
char ptr; 
u32 value stroul("1234", ptr, 10);
把string 1234轉成value 1234
10表10進位(base)

●atoi
value → string

●strcat

●sscanf

●strstr
char *p strstr("abcde", "de")
在abcde中找de, *p為d的位置




2020年9月18日 星期五

[C#] StatusStrip

 1.從工具箱拉StatusStrip,並照下步驟拉兩個StatusLabel.


2.第一個StatusStrip叫Status並修改外觀,第二個無預設名稱.






3.toolStripStatusLabel2.Text = "Test";