Question about C++
-
29-10-2019 - |
سؤال
This is perhaps quite a simple one for some of you.
I was looking at the following serial read function and I can't quite comprehend what &prefix[2]
does here. Does it mean only two bytes can be filled or something else ?
I should also mention this is part of the player/stage platform.
while (1)
{
cnt = 0;
while (cnt != 1)
{
if ((cnt += read(fd, &prefix[2], 1)) < 0)
{
perror("Error reading packet header from robot connection: P2OSPacket():Receive():read():");
return (1);
}
}
if (prefix[0] == 0xFA && prefix[1] == 0xFB)
{
break;
}
GlobalTime->GetTimeDouble(×tamp);
prefix[0] = prefix[1];
prefix[1] = prefix[2];
}
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow