Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )
Written using Qt cross-platform software, expressed in the path of linux and windows systems are different. This article describes a method how to quickly convert '/' and 'path.
/
Turn \
(turn slash backslash)
- Use
QDir::toNativeSeparators
Interface - Example:
QString path = "C:/temp/test.txt";
path = QDir::toNativeSeparators(path);
- Export
"C:\\temp\\test.txt"
\
Turn /
(turn slash backslash)
- use
QDir::fromNativeSeparators
- Example:
QString path = "C:\\temp\\test.txt";
path = QDir::toNativeSeparators(path);
- Export
C:/temp/test.txt