Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to pass QFile pointer to the QTextStream object
QtWS25 Last Chance

how to pass QFile pointer to the QTextStream object

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 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.
  • T Offline
    T Offline
    thippu
    wrote on last edited by
    #1

    Hi Guys,
    I have declared the QFile pointer and I want to pass it to QTextStream object but it says that the invalid use of incomplete type class QTextStream.

    QFile *fp=new QFile("file address");
    QTextStream txtline(fp);
    

    I did

    QTextStream txtline(&fp);
    

    but it did not work for me,
    could you help me?

    J.HilkJ 1 Reply Last reply
    0
    • T thippu

      Hi Guys,
      I have declared the QFile pointer and I want to pass it to QTextStream object but it says that the invalid use of incomplete type class QTextStream.

      QFile *fp=new QFile("file address");
      QTextStream txtline(fp);
      

      I did

      QTextStream txtline(&fp);
      

      but it did not work for me,
      could you help me?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @thippu said in how to pass QFile pointer to the QTextStream object:

      invalid use of incomplete type class QTextStream.

      have you included QTextStream ?

      #include <QTextStream>


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      T 2 Replies Last reply
      4
      • J.HilkJ J.Hilk

        @thippu said in how to pass QFile pointer to the QTextStream object:

        invalid use of incomplete type class QTextStream.

        have you included QTextStream ?

        #include <QTextStream>

        T Offline
        T Offline
        thippu
        wrote on last edited by
        #3

        @J.Hilk Thank you bro.
        It was the mistake. Ur right, It is working fine.

        1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @thippu said in how to pass QFile pointer to the QTextStream object:

          invalid use of incomplete type class QTextStream.

          have you included QTextStream ?

          #include <QTextStream>

          T Offline
          T Offline
          thippu
          wrote on last edited by
          #4

          @J.Hilk Even though I did not do the #include<QTextStream>
          the compiler did not say anything about it?

          J.HilkJ jsulmJ 2 Replies Last reply
          0
          • T thippu

            @J.Hilk Even though I did not do the #include<QTextStream>
            the compiler did not say anything about it?

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @thippu without going through the source code, my guess would be, its somewhere forwart declaired in one of Qt's base classes. So the compiler knows of the class but knows not what to do withit until you add the proper include.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2
            • T Offline
              T Offline
              thippu
              wrote on last edited by
              #6

              Okay, Thanks

              1 Reply Last reply
              0
              • T thippu

                @J.Hilk Even though I did not do the #include<QTextStream>
                the compiler did not say anything about it?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @thippu said in how to pass QFile pointer to the QTextStream object:

                the compiler did not say anything about it?

                It did: "but it says that the invalid use of incomplete type class QTextStream"
                "incomplete type" means that compiler does not know what QTextStream is, which usually means that the include is missing.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                T 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @thippu said in how to pass QFile pointer to the QTextStream object:

                  the compiler did not say anything about it?

                  It did: "but it says that the invalid use of incomplete type class QTextStream"
                  "incomplete type" means that compiler does not know what QTextStream is, which usually means that the include is missing.

                  T Offline
                  T Offline
                  thippu
                  wrote on last edited by
                  #8

                  @jsulm, Thank you.

                  1 Reply Last reply
                  0

                  • Login

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