fwrite求助
在一个选择case里 创建txt并写个字符串 写一直不成功 希望各位大牛帮小弟看看
要在case1 内添加功能 这是代码 单独可以运行 但是添加进去 fwrite没用了 fopen 可以 因为有 xiaopang.txt文件创建
#include<stdio.h>
#include<string.h>
FILE* fp=NULL;
char* str="xldkf";
int length=strlen(str);
case 1:
fp=fopen("F:\\xiaopang.txt","a+");
fwrite(str,length,1,fp);
MessageBox ( pCmdInfo->hwnd, "保护good", _T("SimpleShlExt1"),
MB_ICONINFORMATION );
万分感谢啦
[解决办法]
加fclose(fp);