Improve cross-platform compatibility for Euroc dataset file reading #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses a cross-platform compatibility issue in the dataset file reading logic. The previous implementation used '\r\n' format specifiers for fscanf based on the platform, which could lead to incorrect results on non-Windows systems.
Changes:
Conditional compilation: The code now uses #ifdef _WIN32 to conditionally compile the fscanf format specifier based on the platform.
Windows-specific format: For Windows platforms, the format specifier %2047[^\r]\r\n is used, which matches up to 2047 non-carriage return characters followed by a carriage return and newline sequence.
Linux-specific format: For non-Windows platforms, the format specifier %2047[^\n]\n is used, which matches up to 2047 non-newline characters followed by a newline character.
Benefits:
Improved cross-platform compatibility: The code now works correctly on both Windows and Linux systems.
Enhanced robustness: The code is less likely to fail due to platform-specific differences in newline characters.
Testing:
Tested on Ubuntu 20.04 LTS
By making this change, we can ensure that our code can handle dataset file correctly on a wider range of platforms.
JasonG