私はこれを書きました:
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <mtd/mtd-user.h>
#include <errno.h>
int main( void )
{
int fd;
char buf[4]="abc";
fd = open("/dev/mtd0", O_RDWR);
lseek(fd, 1, SEEK_SET);
write(fd, &buf, 4);
close(fd);
perror("perror output:");
return 0;
}
ファイル /dev/mtd0 は、nandsim カーネル モジュールを使用して作成され、実行されます。
mtdinfo /dev/mtd0
意味のある出力が得られました。プログラムを実行すると、次のように出力されます。
perror output:: Invalid argument
プログラムにエラーがある場合は?