关于文件的问题,vc++6.0能编译成功但是运行就出错了!哪位大神指点迷津下~~
函数代码如下:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void run(char *str)
{
int length = 0;
int i;
char *p = str;
length = strlen(str);
while(*p != '\0')
{
if(*p == '\n' || *p == '\r')
{
*p = '\0';
}
p++;
}
for (i = 0 ; i < length ; i++)
{
str[i] = str[i] ^ 3;
}
}
void main()
{
char *pathr = "C:\\Users\\Administrator\\Desktop\11\\12.txt";
char *pathw = "C:\\Users\\Administrator\\Desktop\11\\1234.txt";
FILE *pfr = fopen(pathr , "r");
FILE *pfw = fopen(pathw , "w");
// char *p;
while(!feof(pfr))
{
char cache[1024] = {0};
fgets(cache , 1023 , pfr);
run(cache);
fputs(cache , pfw);
fputs("\n" , pfw);
}
fclose(pfr);
fclose(pfw);
}