Haoxiang’s Blog
Skip to content
  • Home
  • Blog Posts
  • (中文)
  • (EN)
  • About
  • RSS
  • Messages

March 2012

There were 5 posts published in March 2012 (this is page 1 of 1).

3.17 照片

春假也没出远门,算是好好的休息了一回。 好歹在放假快结束的时候出门透了透气。

in Blog Posts, 中文, 生活 | 2012/03/21 | 2 Comments

fstream issue under 64-bits cygwin

This is a question I posted on StackOverflow: fstream issue under 64-bits cygwin, glad to get help from Nemo on Stackflow, all credits goes to him. The problem is when I use 64-bits g++ to compile the same piece of code, I get unexpected different result. The source code looks like this: #include #include using […]

in Blog Posts, English, Solution | 2012/03/14 | Comment

Use a different delimiter in sed

Think about this, you want to replace “XXX” with a path like “/path/to/YYY” in a file. Your file looks like this: XXX AAA XXX Your bash script looks like this: NEW_PATH=”/path/to/YYY” VAR=”XXX” sed -e ‘{s/$VAR/$NEW_PATH/g}’ your_file Well, it won’t work, since single quotes ‘ will force bash to keep variables as-is. Ok, we try to […]

in Blog Posts, English, Solution | 2012/03/13 | Comment

STL map operator[] not const

STL里Map的Operator[]和其它的Container不太一样。 因为Map的Operator[]可以提供这种操作: map testMap; testMap[“a”] = “b”; 所以Map的Operator[]返回的是T&,而不是const T& 如果需要得到const reference,可以这样: map testMap; const string& constMember = testMap.find(“a”)->second;

in Blog Posts, Solution, 中文 | 2012/03/11 | Comment

UnitTest框架GoogleTest

回到C++下,随着代码量增加,遇到维护问题了。 找到一个Google的UnitTest框架,GoogleTest 有很详细的Sample,推荐一下 :] 编译的时候需要先编译出libgtest.a和gtest_main.o,自己的testXX.cpp文件需要和ligtest.a, gtest_main.o链接。 $g++ testXX.cpp path/to/gtest_main.o -Lpath/to/libgtest.a -lgtest -o testXX

in Blog Posts, Solution, 中文 | 2012/03/09 | Comment
这个网站使用的主机 (我的推广链接)
Independent Publisher empowered by WordPress