要求:
1.做乙個動態庫,提供乙個介面。返回某個檔案目錄下的指定字尾名檔案路徑鍊錶,不包括子目錄。如.pdf;.docx格式。
2.資料結構格式:
typedef struct targetfile targetfile;
struct targetfile
;
read_config.h
typedef struct targetfile targetfile;
struct targetfile
;int getallfile(const char* path, const char* file_suffix, targetfile* root_node);
int freelist(targetfile* head_node);
read_config.cpp
char *strrstr(const char *s, const char *str)
return null;
}int getallfile(const char* path, const char* file_suffix, targetfile* root_node)
char* curr_file_suffix = strrstr(ent->d_name, ".");
if(!(strcmp(file_suffix, curr_file_suffix)))
}closedir(pdir);
return 0;
}int freelist(targetfile* head_node)
return 0;
}
test
int main()
freelist(root_node);
return 0;
}
Qt文件閱讀筆記 寫乙個簡單的單元測試
程式執行截圖如下 控制台 原始碼如下 test.pro qt widgets testlib headers head.h sources source.cpp installs test head.h ifndef head h define head h include class testqs...
編寫乙個簡單的單元測試用例
開發乙個簡單的計算器,用於計算兩個數的加減乘除,示例 1 class calculator 2 實現簡單的加減乘除 3 def init self,a,b 4 self.a int a 5 self.b int b 67 defadd self 8return self.a self.b910 de...
一些常用的技巧(一)單元測試簡單寫
接觸unit test已經快一年了,但很少按照書本上的做,可能是水平不夠,環境不合適吧。不過一些必要的unit test我還是做的,如果功能很關鍵,我會正兒八經寫些測試用例,但大部分情況下,要麼不寫,要麼隨處亂寫,也很少會用到ruby的unit test 關鍵是太懶。懶人就有些懶辦法,比如,我針對某...