关天fseek(fp_Write, 0L, SEEK_END);指向文件未尾应用

lihualiu81 lihualiu81 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
关天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);不能让指针指向文件未尾吗?
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
lihualiu81
嵌入开发(WinCE) 19,524 成员 41,565 内容