原创 C 如何將標準輸出重定向到文件

stdin,stdout,stderr是常量,無法直接賦值? FILE *fp; stdin = fpgcc x86編譯無警告,運行正常。 android gcc(ARM-48) 編譯報錯 error: lvalue required

原创 “gcc-mingw-w64” package in Ubuntu

“gcc-mingw-w64” package in Ubuntu Ubuntu  “gcc-mingw-w64” package g++-mingw-w64: GNU C++ compiler for MinG

原创 snprintf VS itoa

use snprintf, it's the new more portable itoa. itoa is not part of standard C, nor is it part of standard C++; but,

原创 Setting up QCustomPlot

Setting up QCustomPlot Getting QCustomPlot to work with your application is very easy: Get the latest version of QCus

原创 c庫,c++鏈接時碰到undefined reference

庫文件由c代碼生成,在c++代碼中鏈接庫中的函數時,會碰到undefined reference的問題。      把與c語言庫相關的頭文件包含添加一個extern "C"的聲明即可。如下:          問題解決。

原创 GCC(ARM) warning: comparison is always true due to limited range of data type

char ch; while((ch = getopt(argc,argv,"d:h"))!=EOF switch(ch{ case 'h' ... GCC X86    OK!GCC Arm 警告如下 warn

原创 pthread 子線程全局變量訪問

方法1: 全局變量聲明 volatile struct MY_STRUCT *Data;  void* my_thread(void* param); // 子線程內  void* my_thread(void* param){    

原创 C99 實現類似 C++ string.find

去除字符串兩端的特殊字符。string庫裏麼找到合適函數。 #include <stdio.h> #include <string.h> void string_find(char *result, char *source, int

原创 Qt 編譯錯誤: QMetaObject::connectSlotsByName: No matching signal for xxx

in brief: Qtcreator可以自動按空間名稱關聯槽,對應的函數必須寫成“on_控件名_信號名”的格式; 建議還是通過connet函數,人爲顯式地將信號和槽關聯起來。 一旦顯式connect的方法的同時,又將槽函數的名字起成了

原创 gcc warning 枚舉的輸入輸出

typedef enum {A,B,C,}DATA_SOURCE_ENUM; int main(int argc ,char * argv[]){        DATA_SOURCE_ENUM source;        prin

原创 SVN won't import *.a library

Have you checked your global ignore settings. On linux they are stored in ~/.subversion/config The default on my machin

原创 covnerting QString to char

When covnerting QString to char*, try converting int first to std::string, and then to C string QString a = "String";

原创 VMware & Ubuntu下建立Qt5.1.1環境

step1: install GCC & All add-ons step2: install Qt5.1.1, online or offline install as you like; step3: install openGL l

原创 add Windows build environment-mingw to qt5.2.1 on ubuntu(AMD64)

another way to do this  http://silmor.de/qtstuff.cross.php following is my way Ubuntu Software Center install gcc-mi

原创 ubuntu下Qtcreator編寫c/c++程序無法調試的解決辦法

ubuntu12.10(64bit)下使用Qt Creator 5.1.1編寫c/c++程序,在控制檯程序調試的時候出現如下的問題: ptrace: Operation not permitted. Could not attach