Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
What is the output of this program?
Results 1 to 4 of 4

Thread: What is the output of this program?

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    280

    What is the output of this program?

    I'm running this program, but I don't see any output. What do you get?

    Code:
    #include <stdio.h>
    #include <pwd.h>
    #include <unistd.h>
    
    int main (){
    
    
    struct passwd *p  = getpwuid (getuid());
    printf ("(%s)\n", p->pw_gecos);
    return 0;
    }
    # g++ test.cpp
    test.cpp:11:2: warning: no newline at end of file
    # ./a.out
    ()
    #
    There is no output. When I looked in pwd.h, it says the gecos field is the user's name. I guess I don't have a name

  2. #2

    Re:What is the output of this program?

    [quote author=t048 link=board=9;threadid=5313;start=0#51830 date=1034444262]
    I guess I don't have a name
    [/quote]

    Well fix that!
    Code:
    gorn:x:500:500:GoRN ToTheRescue:/home/gorn:/bin/bash
    the user's name is GoRN ToTheRescue, just put something in that field and you'll have a gecos.

  3. #3
    Senior Member
    Join Date
    Jul 2001
    Posts
    280

    Re:What is the output of this program?

    [quote author=gorn link=board=9;threadid=5313;start=0#51836 date=1034480984]
    [quote author=t048 link=board=9;threadid=5313;start=0#51830 date=1034444262]
    I guess I don't have a name
    [/quote]

    Well fix that!
    Code:
    gorn:x:500:500:GoRN ToTheRescue:/home/gorn:/bin/bash
    the user's name is GoRN ToTheRescue, just put something in that field and you'll have a gecos.

    [/quote]

    OK, thanks. Where is this field?

  4. #4
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:What is the output of this program?

    in /etc/passwd

Similar Threads

  1. Java Input/Output
    By vacuumtube in forum Windows - General Topics
    Replies: 0
    Last Post: 01-18-2005, 07:22 AM
  2. GnuPG: Piping output
    By Ashcrow in forum Linux - Software, Applications & Programming
    Replies: 13
    Last Post: 08-10-2002, 12:33 AM
  3. perl - unbuffered output
    By gorn in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 07-21-2002, 04:55 PM
  4. Moving output on screen?
    By GotAnyGrapes? in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 07-19-2002, 09:15 AM
  5. Anyone know how to output pretty colors?
    By morphman in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 05-24-2002, 02:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •