更改程序的工作目錄

windows:

#if 1
//#ifdef NDEBUG
	char *lpstr1 = (char*)malloc(MAX_PATH);
	GetCurrentDirectory(MAX_PATH, lpstr1);
	printf("%d-%s\n", MAX_PATH, lpstr1);
	(strrchr(lpstr1, '\\'))[0] = 0;
	printf("%d-%s\n", MAX_PATH, lpstr1);
	(strrchr(lpstr1, '\\'))[0] = 0;
	printf("%d-%s\n", MAX_PATH, lpstr1);
	SetCurrentDirectory(lpstr1);
//#endif
#endif

linux:

chdir()

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章