#include <iostream>
#include <string>
#include <sstream>
using namespace std;
string int2str(int &);
int main(void) {
int i = 123;
string s;
s = int2str(i);
cout << s << endl;
}
string int2str(int &i) {
string s;
stringstream ss(s);
ss << i;
return ss.str();
}
2012年10月17日 星期三
2012年10月16日 星期二
2012年8月20日 星期一
2012年7月3日 星期二
C/C++ 中的括號
在 C語言中的括號分別化表
{ } 大括號表示函式本體的開始與結束
( ) 小括號在函式的宣告中使用
大括號的另類用法,指定了變數的作用範圍,在大括號中的變數都是局部變數,有效區域只在大括號中有效。有效利用這個特性可以使程式簡單明白。
int a = 5;
{
int a = 2;
printf("Here a=%d!!\n", a);
}
printf(" a=%d!!\n", a);
{ } 大括號表示函式本體的開始與結束
( ) 小括號在函式的宣告中使用
大括號的另類用法,指定了變數的作用範圍,在大括號中的變數都是局部變數,有效區域只在大括號中有效。有效利用這個特性可以使程式簡單明白。
int a = 5;
{
int a = 2;
printf("Here a=%d!!\n", a);
}
printf(" a=%d!!\n", a);
2012年5月29日 星期二
NFSv4 設定
最近在設定CentOS 6 的時候發現, NFS default 是用version 4. 不察之下發現設不起來 ><
底下是NFSv4 的設定
CentOS 6時,由於NFS為NFSv4,需多設定一個檔案為/etc/idmapd.conf 還有必須啟動rpcidmapd服務
Head Node
#### vi /etc/idmapd.conf
[General]
Verbosity = 1 #主要更改
# The following should be set to the local NFSv4 domain name
# The default is the host's DNS domain name.
Domain = snowfox #主要更改
.
. (略)
.
#Local-Realms =
[Mapping]
#Nobody-User = nobody
#Nobody-Group = nobody
然後 將rpcidmapd服務開啟 service rpcidmapd start chkconfig rpcidmapd --level 345 on
訂閱:
文章 (Atom)