PIXNET Logo登入

KwCheng's blog

跳到主文

Blog for Computer Science ...

部落格全站分類:圖文創作

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 11月 15 週四 201222:55
  • C_Cpp : 去除字串的'\n'

ref : http://stackoverflow.com/questions/2693776/removing-trailing-newline-character-from-fgets-input
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(18)

  • 個人分類:C / Cpp
▲top
  • 11月 11 週日 201215:20
  • C/C++ - pass parameter to callback function

ref : http://stackoverflow.com/questions/4644409/passing-parameters-for-callback-function
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(117)

  • 個人分類:C / Cpp
▲top
  • 11月 02 週五 201217:51
  • C/Cpp : 在顯示的數字前面補0

在C中 , 我們可以用sprintf()來建立一個string的format , 
而有時我們會需要用到一些時間格式的format , 像2012-01-01 , 
這時就必須要數字1前面補0 , 
我們可以利用sprintf來達到我們想要的功能 : 
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(7,235)

  • 個人分類:C / Cpp
▲top
  • 11月 01 週四 201216:23
  • C - popen()

在linux的C library中 , 提供了popen() function可以讓我們建立相同於pipeline的功能 ,
popen()的format如下:
FILE *popen(const char *command, const char *mode);
簡單的想 , popen會先執行command , 並傳回一個file pointer 指向該command output的內容, 
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(451)

  • 個人分類:C / Cpp
▲top
  • 11月 01 週四 201211:48
  • C/Cpp : memset()

memset ( void * ptr, int value, size_t num ) , 可以讓我們對pointer所指向的一個記憶體空間塞入資料 ,
在memset中主要有三個參數 , 分別是:
  ptr : Pointer to the block of memory to fill.
  value : Value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value.
  num : Number of bytes to be set to the value.
  for example : 
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(51)

  • 個人分類:C / Cpp
▲top
  • 8月 02 週四 201222:37
  • C - static

在C中 , static是一個Storage-class specifiers,
它的主要作用有兩個,一個是作用域的限制,一個是指定存儲方式。
在作用域限制上:
以static申明的global variable、function不得被其他文件所引用.
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(44)

  • 個人分類:C / Cpp
▲top
  • 8月 02 週四 201222:05
  • C - Volative

Compiler 在編譯程式時常常會對代碼進行優化的動作 , 
所謂優化的動作指的就是....舉個例子:
int i = 2;
int a = i;
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(12)

  • 個人分類:C / Cpp
▲top
  • 8月 02 週四 201220:35
  • c/c++ - sizeof()

在c中 , sizeof() function可以回傳該變數的位元組數目
for example:
int a;
sizeof(a);   //sizeof(a) == 4 , 表示a這個變數為4個bytes.
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(903)

  • 個人分類:C / Cpp
▲top
  • 4月 07 週六 201221:11
  • Cpp - When should I use a "private" constructor?

一般來說 , 宣告在private區域就是代表部給class以外的人使用 , 
所以若把constructor宣告在private區域 , 代表就是不可以對這個class instantize.
So...you should use private constructor when you don't want anyone outside the class to invoke that particular constructor.
The most common use that I see for private (and protected) constructors is in implementing singletons and some types of object factories. 
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(43)

  • 個人分類:C / Cpp
▲top
  • 4月 07 週六 201214:47
  • Cpp - iterator

In C++, an iterator is any object that, pointing to some element in a range of elements (such as an array or a container),
 has the ability to iterate through the elements of that range using a set of operators
(繼續閱讀...)
文章標籤

JerryCheng 發表在 痞客邦 留言(0) 人氣(6)

  • 個人分類:C / Cpp
▲top
12...8»

個人資訊

JerryCheng
暱稱:
JerryCheng
分類:
圖文創作
好友:
累積中
地區:

熱門文章

  • (126)Matlab - 內建變數
  • (9,406)notepad++ - 使用notepad++對文字進行轉碼
  • (444)Mathematics - 判斷point是否在triangle內
  • (34,773)Cpp - ifstream (read file) - 開檔 & 讀檔
  • (66)Solaris - svcs command

文章分類

toggle Software (5)
  • Notepad++ (1)
  • Graphviz (0)
  • Windows (1)
  • Eclipse (8)
  • Sloaris (5)
toggle Programming (11)
  • my_c_lib (7)
  • Shell programming (12)
  • C / Cpp (75)
  • Python (9)
  • Html/CSS (2)
  • JavaScript (18)
  • JSP (4)
  • Matlab (13)
  • PHP (1)
  • SQL (7)
  • Java (59)
toggle Information Retrieval (2)
  • Information Retrieval (7)
  • IR - Lemur (2)
  • Solaris (3)
  • Mathematics (4)
  • computer science (4)
  • Linux (17)
  • Statistics (1)
  • 未分類文章 (1)

最新文章

  • python - time
  • python - thread
  • Javascript - class
  • shell - while loop
  • expect - sftp example
  • javascript injection
  • [轉錄] ls color setting
  • python - inheritance & template pattern
  • sorting by value of dictionary
  • Browse all elements of array

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: