我的目标上有两个相同大小的文件。我只是想,如果他们真的一样吗?如何在vxWorks shell中查看?我的档案:
-> ls "/a0",1
Listing Directory /a0:
-rwxrwxrwx 1 0 0 2336692 Feb 1 1980 vxWorks
-rwxrwxrwx 1 0 0 2336692 Feb 1 1980 vxWorks2
value = 0 = 0x0
->
答案 0 :(得分:2)
比较vxWorks shell中的两个文件非常简单。使用以下调用来执行此操作:
-> fd1=open("/a0/vxWorks",2,0)
New symbol "fd1" added to kernel symbol table.
fd1 = 0x8a4dfe0: value = 5 = 0x5
-> fd2=open("/a0/vxWorks2",2,0)
New symbol "fd2" added to kernel symbol table.
fd2 = 0x8a65fe0: value = 6 = 0x6
-> b1=malloc(2336692)
New symbol "b1" added to kernel symbol table.
b1 = 0x8a89fe0: value = 153153552 = 0x920f010
-> b2=malloc(2336692)
New symbol "b2" added to kernel symbol table.
b2 = 0x8a95fe0: value = 155490272 = 0x94497e0
-> read(fd1,b1,2336692)
value = 2336692 = 0x23a7b4 = pathCondense + 0x9c
-> read(fd2,b2,2336692)
value = 2336692 = 0x23a7b4 = pathCondense + 0x9c
-> strcmp(b1,b2)
value = 0 = 0x0
如果最后一次调用返回'0',则表示文件相同。