|
关天fseek(fp_Write, 0L, SEEK_END);指向文件未尾应用
[复制链接]
关天fseek(fp_Write, 0L, SEEK_END);指向文件未尾应用
bool SaveToBookMark3(char* pBookMarkTitle, char* pUrl )
{
//char FullPath[256] = {"\\Windows\\收藏夹\\"};
char FullPath[256] = {"\\Windows\\Opera9\\Opera6.adr"};
//strcat((char*)FullPath , pBookMarkTitle);
char BookmarkPrex[32] = {"[InternetShortcut]"};
char CReturn[4] = {"\r\n"};
char CUrlHeader[8] = {"URL="};
FILE *fp_Write;
fp_Write =fopen(FullPath, "w+");
if (!fp_Write)
{
return false;
}
fseek(fp_Write, 0L, SEEK_END);
////line 1:
fwrite(BookmarkPrex, sizeof(char), strlen(BookmarkPrex), fp_Write);
fwrite(CReturn, sizeof(char), strlen(CReturn), fp_Write);
//line 2:
fwrite(CUrlHeader, sizeof(char), strlen(CUrlHeader), fp_Write);
fwrite(pUrl, sizeof(char), strlen(pUrl), fp_Write);
//line 3:
fwrite(CReturn, sizeof(char), strlen(CReturn), fp_Write);
fclose(fp_Write);
return true;
}
这样写为什么每次都把以前的内容覆盖了?fseek(fp_Write, 0L, SEEK_END);不能让指针指向文件未尾吗?
|
|