to Use close(int) from< unistd.h > in QT

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mithuncm
    New Member
    • Oct 2008
    • 5

    to Use close(int) from< unistd.h > in QT

    hai all,
    i had read a file using ----

    {
    int i =open (char* ,O_RDONLY );
    .
    .
    close(i);
    }

    every thing works fine in QT except 'close(int)' it says That widget class dont have a function int close(int);
    it have only bool close () ,
    but i need to do the close(int) itself which is from <unistd.h>
    i hve tried using namespace unistd; but didint work
    is that the correct format ?
    or any other way to use close();
  • amonsch
    New Member
    • Nov 2008
    • 7

    #2
    maybe.

    you should try including stdio.h and using

    FILE * fopen ( const char * filename, const char * mode )
    int fclose ( FILE * stream )

    EDIT:
    but if you are using Qt you should definitely use an object of the QFile class.

    ---
    amonsch

    Comment

    • newb16
      Contributor
      • Jul 2008
      • 687

      #3
      ::close(0) maybe?

      yes i do lenghten sir.

      Comment

      • mithuncm
        New Member
        • Oct 2008
        • 5

        #4
        Originally posted by newb16
        ::close(0) maybe?

        yes i do lenghten sir.
        thanx all,
        had gone through this pblm.
        jus done like this

        ::close(int );

        "::"
        will directs to use the close() in external or included directories,
        else it will look in local directories of QT.

        Comment

        • newb16
          Contributor
          • Jul 2008
          • 687

          #5
          Originally posted by mithuncm
          "::"
          will directs to use the close() in external or included directories,
          else it will look in local directories of QT.
          It's not 'directories' 'included' , it is namespace - without '::' 'close()' is found in class' namespace and further search is not performed, and with '::' global namespace is searched.

          Comment

          Working...