Witam,
Od niedawna próbuje uporać się z jednym błędem w moim kodzie.
Funkcja:
bool readPacket(const FileStreamPtr& fin){
try{
if (!fin){
stdext::throw_exception("Error: FileStreamPtr not found");
return false;
}
uint8_t packetCode = fin->getU8();
if (packetCode != 255){
stdext::throw_exception(stdext::format("Error: FileStreamPtr packetCode = %d", packetCode));
return false;
}
id = fin->getU32();
time = fin->getU32();
int16_t msgSize = fin->getU16();
uint8 data[msgSize];
fin->read(&data[0], msgSize);
msg = OutputMessagePtr(new OutputMessage);
msg->addBuffer(msgSize, &data[0]);
}catch(stdext::exception& e) {
g_logger.error(stdext::format("Error in readFrame: %s", e.what()));
return false;
}
return true;
}
OutputMessagePtr getMsg() { return msg; }
uint32_t getTime() { return time; }
uint32_t getId() { return id; }
OutputMessagePtr msg;
uint32_t time = 0;
uint32_t id = 0;
};
Bład w linijce:
uint8 data[msgSize];
Expression must have a constant value.