如何在uClinux上执行一个文件读写程序?
用skyeye模拟ARM,在其上跑uClinux,文件系统是romfs,要运行一段文件读写程序:#include <stdio.h>
#define MAXLEN 8
int main (void)
{
int rc;
FILE * outfile, *infile;
unsigned char buf;
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.
不知道哪位高手知道应该怎么解决? romfs = READ-ONLY memory filesystem. 对啊,就是不知道怎么把只读文件系统改为可读写的 那就不要用 romfs 。 默认的文件系统就是romfs啊
页:
[1]