Output with Qdebug

Source: Internet
Author: User

1. Output like printf ()

%a,%a read in a floating-point value (valid only C99)
%c reads in one character
%d read-in decimal integer
%i read in decimal, octal, hexadecimal integer
%o Read in octal integer
%x,%x read in hexadecimal integer
%s reads a string, ending with a space, tab, or line break.
%f,%f,%e,%e,%g,%g is used to enter real numbers, which can be entered in decimal or exponential form.
%p read in a pointer
%u read in an unsigned decimal integer
%n the equivalent number of characters that have been read into the value
%[] Scan Character Set
Percent Read% sign

2. Output like cout<<

Note: However, when you output a qstring string, double quotes are automatically added.
Code:

#include<QDebug>int main(){    int  a;    char b;    QString s = QString("hello world");    qDebug()<<"s:"<<s;    s.sprintf("%d %c",a=2,b=‘b‘);  //格式化字符串    qDebug("s:%d",a);  //格式化输出    return0;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Output with Qdebug

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.