Relationship between FILE * and channel number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jorba101
    New Member
    • Jun 2008
    • 86

    Relationship between FILE * and channel number

    I have following question:

    Once I open a file with fopen(), is there any way in which I can get its channel identifier? (i.e. the number I'd get if I was openning the same file with syscall open()).

    Thanks.-
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by jorba101
    I have following question:

    Once I open a file with fopen(), is there any way in which I can get its channel identifier? (i.e. the number I'd get if I was openning the same file with syscall open()).

    Thanks.-
    Did u check the structure details of the FILE?
    I think there will be a way to that.

    Raghu

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Search for a function fileno(FILE* file). It should be declared in <fildes.h>
      This is all non-standard stuff of course ...

      kind regards,

      Jos

      Comment

      • jorba101
        New Member
        • Jun 2008
        • 86

        #4
        Is it possible that fildes.h does not exist in UNIX? (I couldn't find it in http://www.opengroup.o rg/onlinepubs/007908799/xshix.html).

        On the other hand, I found fdopen() standard UNIX function that will do.

        Thanks all,

        Comment

        Working...