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. _fileno returns different value in Visual Studio and QtCreator
Qt 6.11 is out! See what's new in the release blog

_fileno returns different value in Visual Studio and QtCreator

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 984 Views 1 Watching
  • 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.
  • InsaneZulolI Offline
    InsaneZulolI Offline
    InsaneZulol
    wrote on last edited by InsaneZulol
    #1

    This is the value in VS: vs
    This is the value in QtCreator:qt

    Why would I be getting two different values for _fileno(stdout) in two different IDEs using same compiler and same code?
    I use same compiler in both, msvc.

    tl;dr my _fileno(stdout) returns -2 in VS and 1 in QtCreator.

    JonBJ 1 Reply Last reply
    0
    • InsaneZulolI InsaneZulol

      This is the value in VS: vs
      This is the value in QtCreator:qt

      Why would I be getting two different values for _fileno(stdout) in two different IDEs using same compiler and same code?
      I use same compiler in both, msvc.

      tl;dr my _fileno(stdout) returns -2 in VS and 1 in QtCreator.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @InsaneZulol
      Presumably you do not get this difference if you run the app on each system outside of Creator?

      Are you running in Debug mode? Maybe to do with how they redirect to capture into the IDE console? Again, do you get the same result if you let each IDE run it not in Debug mode?

      EDIT I did not see you said it is returning -2. That seems odd.

      InsaneZulolI 1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        According to the documentation -2 is the value returned when there's no output stream associated with given stream handle.
        I'm guessing you're compiling/running your app as windowed in VS (/SUBSYSTEM:WINDOWS) and as a console application in Qt Creator so there's a valid output stream there.

        1 Reply Last reply
        2
        • JonBJ JonB

          @InsaneZulol
          Presumably you do not get this difference if you run the app on each system outside of Creator?

          Are you running in Debug mode? Maybe to do with how they redirect to capture into the IDE console? Again, do you get the same result if you let each IDE run it not in Debug mode?

          EDIT I did not see you said it is returning -2. That seems odd.

          InsaneZulolI Offline
          InsaneZulolI Offline
          InsaneZulol
          wrote on last edited by
          #4

          @Chris-Kawa I think I understand. Even tho my Qt app is not a console app nor do I start it from terminal - "Application Output" window is valid console output and thats why it doesn't result in -2 in QtCreator. 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