当前位置:编程学习 > wap >>

Qt输出函数的问题

GTK中有g_print("hello world\n")可以把hello word输出到现实屏上
这个功能在Qt中对应的是哪个函数?
找不到? --------------------编程问答-------------------- 求助啊 --------------------编程问答-------------------- 如果要显示到终端上的话,可以试试qDebug << "hello world\n";

或者直接调用C++的
#include <iostream>

std::cout << "hello world\n"; --------------------编程问答--------------------
引用 2 楼  的回复:
如果要显示到终端上的话,可以试试qDebug << "hello world\n";

或者直接调用C++的
#include <iostream>

std::cout << "hello world\n";

好,我试试 --------------------编程问答-------------------- Qt也有类似的方法

QTextStream(stdout) << "hello world\n";
--------------------编程问答-------------------- 工程设置里添加
CONFIG += console --------------------编程问答--------------------

#include <QDebug>

qDebug() << "hello, world";


我想楼主应该是这样的意思. --------------------编程问答--------------------
引用 6 楼  的回复:
C/C++ code


#include <QDebug>

qDebug() << "hello, world";



我想楼主应该是这样的意思.

虽然可以,但要注意release版中是不会有此输出的。

如果要在控制台下输出信息(注意,不是调试信息),用QTextStream是最合适的,使用参数stdout和stderr会把信息输出到标准输出和错误输出上。

如果只想打出调试信息,尽管用qDebug() --------------------编程问答--------------------
引用 6 楼  的回复:
C/C++ code

#include <QDebug>

qDebug() << "hello, world";



我想楼主应该是这样的意思.


error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘const char [29]’ to binary ‘operator<<’
不能用,提示这个错误 --------------------编程问答-------------------- 用scanf(),这个标C的函数吧,我也在找,找不到啊。
补充:移动开发 ,  Qt
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,