项目中简单的程序添加

1.windows的相对路径和绝对路径变更

例:E:/vs2010/test.cpp   变成  E://vs2010//test.cpp


char * ChangePath(char *dst, const char *src)
{
	char *ret = dst;
	while ((*dst++ = *src++) != '\0')
	{
		if (*src == '\\')
			*dst++ = '\\';
	}
	return ret;
}

C语言fopen(path,“type”);  path好像要E://vs2010//test.cpp

注:关于路径可使用问题:

window系统    相对路径   1.fp2=fopen("..\\..\\test.txt",   "wb+"))   2.  ..\test.txt        绝对路径: C://vs2010//test1.cpp

linux系统         相对路径    1.   ./test


你可能感兴趣的:(测试代码)