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
Forum Updated to NodeBB v4.3 + New Features

how to pass QFile pointer to the QTextStream object

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.5k 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 16 Aug 2018, 12:03 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 1 Reply Last reply 16 Aug 2018, 12:06
    0
    • T thippu
      16 Aug 2018, 12:03

      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 Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 16 Aug 2018, 12:06 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 16 Aug 2018, 12:12
      4
      • J J.Hilk
        16 Aug 2018, 12:06

        @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 16 Aug 2018, 12:12 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 J.Hilk
          16 Aug 2018, 12:06

          @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 16 Aug 2018, 12:16 last edited by
          #4

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

          J J 2 Replies Last reply 16 Aug 2018, 12:18
          0
          • T thippu
            16 Aug 2018, 12:16

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

            J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 16 Aug 2018, 12:18 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 16 Aug 2018, 12:23 last edited by
              #6

              Okay, Thanks

              1 Reply Last reply
              0
              • T thippu
                16 Aug 2018, 12:16

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

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 16 Aug 2018, 12:59 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 18 Aug 2018, 12:30
                2
                • J jsulm
                  16 Aug 2018, 12:59

                  @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 18 Aug 2018, 12:30 last edited by
                  #8

                  @jsulm, Thank you.

                  1 Reply Last reply
                  0

                  1/8

                  16 Aug 2018, 12:03

                  • Login

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