|
|
|
Re: Lego Ports couldn't be read [message #1805794 is a reply to message #1805592] |
Wed, 24 April 2019 08:19 |
Jose Maria Jesus Cabral Lassalle Messages: 199 Registered: February 2016 |
Senior Member |
|
|
Hi,
thanks for the detailed information. It really helps!
Regarding your issue: I think you already found the issue. If !mAddressFile.fail isnot true, it means that reading the file failed. You can see http://www.cplusplus.com/reference/istream/istream/read/ for more information. Maybe the error occurs before reading (at seekg or clear()). Write permissions are not the problem here I'd say. Unfortunately I cannot help more here.
Regarding paIsInput, this is comes from the FB (IX, IW, ID). The if statement are to prevent using it incase someone uses for example a QX with sensor. Now, this could probably be done before calling setupSensor().
And, as you pointed out, there are some weird things in the code. This code was writen 3 years ago and never again maintaned. There are many "if (true == VARIABLE)" that can be replace for "if(VARIABLE)" and lot of logging errors are missing that would make debugging quicker (as in your case for example).
we are always happy to see new people contributing to the code. If you want improve C++ skills, this is a great opportunity. I guarantee you that you'll get good reviewers. See https://www.eclipse.org/4diac/en_help.php?helppage=html/development/contributeToForte.html for more information.
|
|
|
Re: Lego Ports couldn't be read [message #1805820 is a reply to message #1805794] |
Wed, 24 April 2019 18:59 |
|
Hi,
I had a look on the documentation for stream. It seams that fail will return true also if it could not read the required number of bytes. Could you try if something chagnes when you replace the if in question with the following if: if (!mAddressFile.fail() || mAddressFile.eof()){
Thanks,
Alois
|
|
|
|
Powered by
FUDForum. Page generated in 0.03392 seconds