Platform independant getpwnam?

Discussion in 'Ruby' started by gga, Mar 8, 2005.

  1. gga

    gga Guest

    On linux:
    require 'etc'
    uid = Etc::getpwnam(username).uid

    this works fine, but on windows, this fails miserably. Is there a
    platform independent way of getting the uid for any username (so as to
    later use that uid against File::Stat.uid)?
     
    gga, Mar 8, 2005
    #1
    1. Advertising

  2. gga wrote:
    > On linux:
    > require 'etc'
    > uid = Etc::getpwnam(username).uid
    >
    > this works fine, but on windows, this fails miserably. Is there a
    > platform independent way of getting the uid for any username (so as

    to
    > later use that uid against File::Stat.uid)?


    require "win32/etc"
    include Win32

    uid = Etc.getpwnam(username).uid

    Regards,

    Dan

    PS - Keep an eye out for the sys-admin package, coming soon.
    PS2 - I plan on redefining File.stat in the win32-file package.
     
    Daniel Berger, Mar 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Keller

    Problem with getpwnam() syscall

    Thomas Keller, Jan 19, 2004, in forum: Perl
    Replies:
    1
    Views:
    1,391
    Joe Smith
    Jan 20, 2004
  2. Jason Williard

    Using getpwnam() with CGI

    Jason Williard, Apr 22, 2005, in forum: Perl
    Replies:
    0
    Views:
    2,731
    Jason Williard
    Apr 22, 2005
  3. Nicky Kotze
    Replies:
    2
    Views:
    360
  4. Lew
    Replies:
    19
    Views:
    594
    Andreas Leitgeb
    Jan 11, 2011
  5. Thomas Keller

    Problem with getpwnam() syscall

    Thomas Keller, Jan 20, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    190
    Ben Morrow
    Jan 20, 2004
Loading...

Share This Page