Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Learning
  3. Qt in Education
  4. A Question about QFile & QTextStream

A Question about QFile & QTextStream

Scheduled Pinned Locked Moved Qt in Education
2 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    konalo
    wrote on last edited by
    #1

    A method loadFile which is a module of a program , a part of a notepad

    void ImgProcessor::loadFile(QString filename)
    {
        printf("file name:%s\n",filename.data());
        QFile file(filename);
        if(file.open(QIODevice::ReadOnly|QIODevice::Text))
        {
            QTextStream textStream(&file);
            while(!textStream.atEnd())
            {
               showWidget->text->append(textStream.readLine());
               // printf("read line \n");  ??????
                //printf("end\n");   ????
            }
        }
    }
    

    who can tell me ,why there are two "printf"
    when i comment it ,nothing different ,
    i can't understand the "printf"

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      printf is just the "C way" of printing to standard output. it does nothing useful for the program, it just prints stuff to the console

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved