bool SaveIndexToFile( &vec_Static)//这里是举例
{
//存放路径的变量
char Buf[MAX_PATH];
ZeroMemory(Buf,MAX_PATH);
char TargetBuf[MAX_PATH];
ZeroMemory(TargetBuf,MAX_PATH);
//获取程序的当前目录
GetCurrentDirectory(MAX_PATH,Buf);
int nLen = strlen(Buf);
string strt;
int pos = 0;
if (nLen >= 1)
{
strt = Buf;
pos = strt.find("XXXX");
if ( pos > 0)
{
strncpy(TargetBuf,Buf,pos);
strcat(TargetBuf,"\Index.ind");
FILE* pf = 0;
pf = fopen(TargetBuf, "wb+");
if (pf)
{
int nCount = vec_Static.size();
if (nCount > 0 )
{
for (int i = 0 ; i < nCount; i++)
{
fprintf(pf,"%d\r\n",vec_Static[i].ID);
}
fclose(pf);
return true;
}
}
}
}
return false;
}