//file_io.h
#include <iostream>
#include <fstream>
#include <string>
#define __QUARY_PATH__ "C:\\Users\\wu-b_neu\\Documents\\Visual Studio 2008\\Projects\\Test\\Test\\file_path.txt"
namespace NS_file_io
{
using std::string;
string _get_goal_file_path()
{
FILE* _fp_quary_path = fopen(__QUARY_PATH__,"r+");
char str[100];memset(str,0x00,sizeof(str));
fgets(str,sizeof(str),_fp_quary_path);
fclose(_fp_quary_path);//std::cout << str[3] << std::endl;
string res(str,3,strlen(str) - 1);return res;
}
}
//file_io.cpp
#include "file_io.h"
using namespace NS_file_io;
string _io_path = _get_goal_file_path();
string _get_io_path()
{
return _io_path;
}
//main.cpp
#include <iostream>
#include <string>
#define __IO_PATH__ _get_io_path()
extern std::string _get_io_path();
int main()
{
std::cout << __IO_PATH__ << std::endl;
return 0;
}
//file_path.txt
"C:\\Users\\wu-b_neu\\Desktop\\IO.txt"