|
用skyeye模拟ARM,在其上跑uClinux,文件系统是romfs,要运行一段文件读写程序:
#include <stdio.h>
#define MAXLEN 8
int main (void)
{
int rc;
FILE * outfile, *infile;
unsigned char buf[MAXLEN];
outfile = fopen("/home/write", "wb");
infile = fopen("/home/read", "rb");
if(outfile == NULL || infile == NULL)
{
printf("open file error.\n");
return 0;
}
while((rc = fread(buf,sizeof(unsigned char), MAXLEN, infile)) != 0)
{
printf("buf now is %s\n", buf);
fwrite(buf, sizeof(unsigned char), rc, outfile);
}
fclose(infile);
fclose(outfile);
return 0;
}
执行结果是:
open file error.
不知道哪位高手知道应该怎么解决? |
|