Obsolete Members for QTextStream

QTextStream 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够正常运行。我们强烈建议不要在新代码中使用它们。

公共函数

(deprecated in 6.12) QTextStream &operator>>(char *c)

成员函数文档

[deprecated in 6.12] QTextStream &QTextStream::operator>>(char *c)

自 6.12 版本起,此函数已被废弃。我们强烈建议不要在新代码中使用它。

请使用QByteArray 的重载版本。此函数无法安全使用。此函数将在Qt 7中被移除。

将该单词转换为 UTF-8 并将其存储在 `c` 中,末尾以 '\0' 字符结束。如果没有可用的单词,则仅存储 '\0' 字符。

警告:尽管该运算符使用方便,但存在风险,必须谨慎使用。QTextStream 假设c 指向的缓冲区有足够的空间容纳该字符串。如果缓冲区过小,应用程序可能会崩溃。对于由n 个 QChar 组成的字符串,缓冲区长度至少需要3*n+1 个字符。

如果可能,请改用QByteArray 运算符。

这是一个重载函数。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.