Like Tree1Likes

Confussion with Username

This is a discussion on Confussion with Username within the C Programming forums, part of the General Programming Boards category; Hi, I'm relatively new to C and have created my first propper programme. The programme works as required but I ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    16

    Confussion with Username

    Hi, I'm relatively new to C and have created my first propper programme. The programme works as required but I now want to add a Username system where the user types their name in at the beggining and this then becomes the name used throughout the programme.

    This is the base code that I have got working:

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <conio.h>
    #define North=0
    #define East=1
    #define South=2
    #define West=3
    int GetDirection (int RoomNumber);
    void DescribeRoom (int Fig);
    void DescribeExit (int Fig);
    void SetupRooms();
    typedef struct{
      char RoomName[50];
      char Description[400];
      char Description2[400];
      unsigned int Exit[4];
    }Location;
    Location Room[15];
    //Main function
    void main(){
     unsigned int RoomNumber = 15; 
     unsigned int Direction;
     SetupRooms();
      while(1){
      
       system("cls");
       DescribeRoom(RoomNumber);
       DescribeExit(RoomNumber);
       Direction = GetDirection(RoomNumber);
       if(Direction==99)exit(0);
       if(Direction>0)RoomNumber= Direction;
      else
      {
       printf ("\nInvalid entry\n");
       for (long i=0; i<5e8; i++);   // Tony's code
      }
     }
    }
    //DescribeRoom Function
    void DescribeRoom (int Fig){
    printf("Currently possition: ");
    printf(Room[Fig].RoomName);
    printf(Room[Fig].Description);
    printf(Room[Fig].Description2);
    }
    
    //DescribeExit Function
    void DescribeExit (int Fig){
     printf("\n\nHe could go to any of the following places...\n");
     printf("\n--------------------------------------------------------------------\n");
     if(Room[Fig].Exit[North]!=0) printf ("\n(N) To the North he sees the %s",Room[Room[Fig].Exit[North]].RoomName);
     if(Room[Fig].Exit[East]!=0) printf ("\n\n(E) East is the %s",Room[Room[Fig].Exit[East]].RoomName);
     if(Room[Fig].Exit[South]!=0) printf ("\n\n(S) Looking South is the %s",Room[Room[Fig].Exit[South]].RoomName);
     if(Room[Fig].Exit[West]!=0) printf ("\n\n(W) Going West will take him to the %s",Room[Room[Fig].Exit[West]].RoomName);
     printf("\n\n--------------------------------------------------------------------");
     printf("\n\n\nJust type the first letter of the direction or press 'Q' to quit."); 
    }
    
    //GetDirection Function
    int GetDirection(int Fig)
    {
     char test;
     unsigned int NewDirection=0;
     while(1)
     {
      test=getch();
      if(test=='n') NewDirection=Room[Fig].Exit[North];
      if(test=='e') NewDirection=Room[Fig].Exit[East];
      if(test=='s') NewDirection=Room[Fig].Exit[South];
      if(test=='w') NewDirection=Room[Fig].Exit[West];
      if(test=='q') NewDirection=99;
      
      if(NewDirection!=0) return(NewDirection);
      printf("\n\nYou cannot go that way, there must be another path to take.");
     }
    }
    void SetupRooms(){
    //ROOM 1
    strcpy(Room[1].RoomName, "Outside");
    strcpy(Room[1].Description, "\n\nHis eyes slowly rested back upon the house. Its unkept walls wore a thin green\ncoat of algae.");
    strcpy(Room[1].Description2, "\nThe trees produced shadows, dancing along the empty flower beds as a slow wind\nkissed the top of the branches. It looked sorry, lonely, friendly.\n\n");
    Room[1].Exit[North]=2;  
    Room[1].Exit[East]=0;  
    Room[1].Exit[West]=0;  
    Room[1].Exit[South]=0;  
    //ROOM 2
    strcpy(Room[2].RoomName, "Entrance");
    strcpy(Room[2].Description, "\n\nHe was greeted by a wide staircase, covered in what would have been a plush,\nwhite carpet.");
    strcpy(Room[2].Description2, "\nHis eyes were drawn up the stairs but his better judgment told him to look\naround the ground floor first.\n\n");
    Room[2].Exit[North]=7;  
    Room[2].Exit[East]=4;  
    Room[2].Exit[West]=3;  
    Room[2].Exit[South]=1;  
    //ROOM 3
    strcpy(Room[3].RoomName, "Office");
    strcpy(Room[3].Description, "\n\nHe slowly edged the door open, his left hand resting on the top of the blade\nhanging naturally off his hip.");
    strcpy(Room[3].Description2, "\nThe chair lay helplessly on the floor, paper strewn around its base. The room\nbore nothing of interest.\n\n");
    Room[3].Exit[North]=0;  
    Room[3].Exit[East]=2;  
    Room[3].Exit[West]=0;  
    Room[3].Exit[South]=0;  
    //ROOM 4
    strcpy(Room[4].RoomName, "Small Hallway 1");
    strcpy(Room[4].Description, "\n\nOn the other side of the hallway he came across two doors. The one to his left\nwas ajar, the other closed tightly.");
    strcpy(Room[4].Description2, "\nThe small hallway brought him a feeling of both comfort and clostrophobia.\n\n");
    Room[4].Exit[North]=5;  
    Room[4].Exit[East]=6;  
    Room[4].Exit[West]=2;  
    Room[4].Exit[South]=0;  
    //ROOM 5
    strcpy(Room[5].RoomName, "Downstairs Bathroom");
    strcpy(Room[5].Description, "\n\nThe room was the same as the day it was left. It was not big, or luxurious, but instead a reminder of what had been.");
    strcpy(Room[5].Description2, "\nHe spent a minute searching the shelves, but a man in his position found little use for aftershave.\n\n");
    Room[5].Exit[North]=0;  
    Room[5].Exit[East]=0;  
    Room[5].Exit[West]=0;  
    Room[5].Exit[South]=4;  
    //ROOM 6
    strcpy(Room[6].RoomName, "Downstairs Bedroom");
    strcpy(Room[6].Description, "\n\nThe cream walls adorned with posters, pictures and memories all suggested that\nof a youth");
    strcpy(Room[6].Description2, "\nA double bed lay half dressed with belongings hurriedly strewn across it.\nMusical instruments, a guitar, a drum set.\n\n");
    Room[6].Exit[North]=0;  
    Room[6].Exit[East]=0;  
    Room[6].Exit[West]=4;  
    Room[6].Exit[South]=0; 
    //ROOM 7 
    strcpy(Room[7].RoomName, "Landing");
    strcpy(Room[7].Description, "\n");
    strcpy(Room[7].Description2, "\n");
    Room[7].Exit[North]=11;  
    Room[7].Exit[East]=9;  
    Room[7].Exit[West]=8;  
    Room[7].Exit[South]=2;
    //ROOM 8
    strcpy(Room[8].RoomName, "Living Room");
    strcpy(Room[8].Description, "\nBLAH\n\n");
    Room[8].Exit[North]=0;  
    Room[8].Exit[East]=7;  
    Room[8].Exit[West]=0;  
    Room[8].Exit[South]=0; 
    //ROOM 9
    strcpy(Room[9].RoomName, "Kitchen");
    strcpy(Room[9].Description, "\nBLAH\n\n");
    Room[9].Exit[North]=0;  
    Room[9].Exit[East]=10;  
    Room[9].Exit[West]=7;  
    Room[9].Exit[South]=0;
    //ROOM 10
    strcpy(Room[10].RoomName, "Utility Room");
    strcpy(Room[10].Description, "\nBLAH\n\n");
    Room[10].Exit[North]=0;  
    Room[10].Exit[East]=0;  
    Room[10].Exit[West]=9;  
    Room[10].Exit[South]=0;  
    //ROOM 11
    strcpy(Room[11].RoomName, "Upstairs Hallway");
    strcpy(Room[11].Description, "\nBLAH\n\n");
    Room[11].Exit[North]=13;  
    Room[11].Exit[East]=14;  
    Room[11].Exit[West]=12;  
    Room[11].Exit[South]=7;  
    //ROOM 12 
    strcpy(Room[12].RoomName, "Bedroom 1");
    strcpy(Room[12].Description, "\nBLAH\n\n");
    Room[12].Exit[North]=0;  
    Room[12].Exit[East]=11;  
    Room[12].Exit[West]=0;  
    Room[12].Exit[South]=0;  
    //ROOM 13 
    strcpy(Room[13].RoomName, "Bedroom 2");
    strcpy(Room[13].Description, "\nBLAH\n\n");
    Room[13].Exit[North]=0;  
    Room[13].Exit[East]=0;  
    Room[13].Exit[West]=0;  
    Room[13].Exit[South]=11; 
    //ROOM 14
    strcpy(Room[14].RoomName, "Upstairs Bathroom");
    strcpy(Room[14].Description, "\nBLAH\n\n");
    Room[14].Exit[North]=0;  
    Room[14].Exit[East]=0;  
    Room[14].Exit[West]=11;  
    Room[14].Exit[South]=0;   
    //ROOM 15
    strcpy(Room[15].RoomName, "Introduction");
    strcpy(Room[15].Description, "\n\n%s stood in the centre of the road, fully aware of this shadowed eyes and \nslumped shoulders.");
    strcpy(Room[15].Description2,"\nThe chill of night pinched his skin and woke him from his thoughts.\n\n");
    Room[15].Exit[North]=1;  
    Room[15].Exit[East]=0;  
    Room[15].Exit[West]=0;  
    Room[15].Exit[South]=0;   
    
    }
    I have writen the following to get a username:

    Code:
    {
    char user[20];
     printf("What is your name?");
    gets(user);
     printf("Your username is %s",user);
    }
    I do not understand how I can use this outside of the Main function. Do I need to assign it to a global variable?? If so I cannot work out how?! Any help would be appreciated.

    Thanks.

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    Instead of declaring user in that function, pass user as a parameter to the function. It's also a good idea to pass the size of the array as another parameter, and use fgets instead of gets to protect against overrunning the bounds of the array:

    Code:
    void get_username( char *user, int size ) 
    {
        printf("What is your name?");
        fgets(user, size, stdin);
        printf("Your username is %s",user);
    }
    Declare the array in main, and then call get_username:
    Code:
    char user[SIZE];
    get_username( user, SIZE );
    smokeyangel likes this.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Can you explain a bit more how you intend to use that in a function? As it's presented above you would not need any global variables, but it wouldn't be that useful in the context of the first code you posted.

    Code:
    void foo(){
        char user[20];
        printf("What is your name?");
        gets(user);
        printf("Your username is %s",user);
    }
    You should not use gets btw, the above will crash if someone use more than 20 characters, and there is no way to prevent that. Use fgets instead.

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    535
    You could use a global variable. Just put
    Code:
    char user[20];
    outside of any functions, at the top of the file so it's visible to all the functions. Then just use it as you would if you'd declared it inside the function.

    It's not really good programming practice to use globals though unless they're absolutely necessary. In this case it would be better to pass it as a parameter as R.Stiltskin suggested.

  5. #5
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Code:
    #define North=0
    #define East=1
    #define South=2
    #define West=3
    I'm confused. Two threads, two different posters same code
    Kurt

  6. #6
    Registered User
    Join Date
    Apr 2012
    Posts
    16
    ZuK - We are working on the same project experimenting with adding to the programme and both realising we are somewhat out of our league.

    Can you explain a bit more how you intend to use that in a function?
    Subsonics - Where the programme is describing rooms I want to have the users individual name instead of a generised character. At the moment I have just put "His eyes slowly rested upon the house..." When I want "<username>'s eyes slowly rested upon the house...". I hope that is clear. I want to be able to call the users name that they entered at the beggining at points throughout the code to fit the dialouge.

    R.Stiltskin - Thank you for your speedy response. I can't say I fully understand parameters. Is this just a block of memory that can be used by multiple functions? I also, in my lack of experience, found your code hard to place into my origional.

    Thanks all.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Then you should be able to use what R.Stiltskin did, but you may have to remove a new line character in the string as fgets includes that in the string if it's present.

  8. #8
    Registered User
    Join Date
    Apr 2012
    Posts
    16
    Why am I getting a Type mismatch for this?

    Code:
    //Main function
    void main(){
    {
     char user[50];
     get_username( user, 50 );
    }
     unsigned int RoomNumber = 15; 
     unsigned int Direction;
     SetupRooms();
      while(1){
      
       system("cls");
       DescribeRoom(RoomNumber);
       DescribeExit(RoomNumber);
       Direction = GetDirection(RoomNumber);
       if(Direction==99)exit(0);
       if(Direction>0)RoomNumber= Direction;
      else
      {
       printf ("\nInvalid entry\n");
       for (long i=0; i<5e8; i++);   // Tony's code
      }
     }
    }
    //User Function
    void get_username( char *user, int size ) 
    {
        printf("What is your name?");
        fgets(user, size, stdin);
        printf("Your username is %s",user);
    }
    I am missing something obvious I know .

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    for (long i=0; i<5e8; i++);

    Quzah.
    Hope is the first step on the road to disappointment.

  10. #10
    Registered User
    Join Date
    Mar 2010
    Posts
    535
    I thought it'd be because you've called get_username before your declared it. Move the whole function above main, or put a prototype at the top of the file:

    Code:
    // prototype tells the compiler what types the function takes/returns. 
    void get_username( char *user, int size );

  11. #11
    Registered User
    Join Date
    Apr 2012
    Posts
    16
    Quazah - This is a section of code that I have forgot to remove. I innitialy had it so the message that pops up when the user hits the wront key dissapears over time. However, this kinda failed on me and that was as far as I got. I cannot get that to work with the current programme.

    Again, Thanks for your help. I realise that I am well in above my head and probably anoying everyone in this forum.

  12. #12
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    Quote Originally Posted by ShotgunChimp View Post
    I can't say I fully understand parameters. Is this just a block of memory that can be used by multiple functions? I also, in my lack of experience, found your code hard to place into my origional.
    Thanks all.
    Parameters are values that are passed from one function to another. In the case of the char* pointer, the value that's being passed is the address of a char variable. This variable (in this case the first element of the array) is declared in main so normally it's only accessible in main, but if main passes its address to another function, the other function can access the same block of memory.

    In the case of SIZE (an int), we're only passing the value of that int variable or constant. The called function gets its own local copy of that value which it can use locally, but it can't modify the value of the original variable.

    To use that code, place the entire function get_username before your main function. The declaration of the array char user[SIZE]; goes in the beginning of your main function, among all your other variable declarations. Calling the function
    Code:
    get_username( user, SIZE );
    goes in main, wherever you want to input the username (obviously, someplace after the declaration of the array).

    And SIZE should be defined as a constant where your other constants are defined, at the beginning of the program.
    Code:
    #define SIZE 20
    One last note: gets is dangerous and should not be used. Never. gets is "blind" as to the size of the array that it's filling, so it can easily overrun the bounds of that array and programs that use it can be exploited by buffer overrun attacks. fgets is the preferred alternative because it sets a limit on the amount of data that will be stored in the array.

  13. #13
    Registered User
    Join Date
    Apr 2012
    Posts
    16
    R.Stiltskin - Thank you so much for the help and dumbed down discription. I feel very sub-par at this.

    I have done everything you stated, to the word, and it works. However it results in an "access violation" after the username is inputted. Thanks.

  14. #14
    Registered User
    Join Date
    Apr 2012
    Posts
    16
    Am I doing something obviously wrong to cause this Access Violation?

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <conio.h>
    #define North=0
    #define East=1
    #define South=2
    #define West=3
    #define SIZE=20
    int GetDirection (int RoomNumber);
    void DescribeRoom (int Fig);
    void DescribeExit (int Fig);
    void SetupRooms(); 
    typedef struct{
      char RoomName[50];
      char Description[400];
      char Description2[400];
      unsigned int Exit[4];
    }Location;
    Location Room[15];
    //Username Function
    void get_username( char *user, int size ) 
    {
        printf("What is your name?");
     fgets(user, size, stdin);
        printf("Your username is %s",user);
    }
    //Main function
    void main(){
     char user[SIZE];
     get_username( user, SIZE );
     unsigned int RoomNumber = 15; 
     unsigned int Direction;
     SetupRooms();
      while(1){
      
       system("cls");
       DescribeRoom(RoomNumber);
       DescribeExit(RoomNumber);
       Direction = GetDirection(RoomNumber);
       if(Direction==99)exit(0);
       if(Direction>0)RoomNumber= Direction;
      else
      {
       printf ("\nInvalid entry\n");
       for (long i=0; i<5e8; i++);   // Tony's code
      }
     }
    }
    
    //DescribeRoom Function
    void DescribeRoom (int Fig){
    printf("Currently possition: ");
    printf(Room[Fig].RoomName);
    printf(Room[Fig].Description);
    printf(Room[Fig].Description2);
    }
    
    //DescribeExit Function
    void DescribeExit (int Fig){
     printf("\n\nHe could go to any of the following places...\n");
     printf("\n--------------------------------------------------------------------\n");
     if(Room[Fig].Exit[North]!=0) printf ("\n(N) To the North he sees the %s",Room[Room[Fig].Exit[North]].RoomName);
     if(Room[Fig].Exit[East]!=0) printf ("\n\n(E) East is the %s",Room[Room[Fig].Exit[East]].RoomName);
     if(Room[Fig].Exit[South]!=0) printf ("\n\n(S) Looking South is the %s",Room[Room[Fig].Exit[South]].RoomName);
     if(Room[Fig].Exit[West]!=0) printf ("\n\n(W) Going West will take him to the %s",Room[Room[Fig].Exit[West]].RoomName);
     printf("\n\n--------------------------------------------------------------------");
     printf("\n\n\nJust type the first letter of the direction or press 'Q' to quit."); 
    }
    
    //GetDirection Function
    int GetDirection(int Fig)
    {
     char test;
     unsigned int NewDirection=0;
     while(1)
     {
      test=getch();
      if(test=='n') NewDirection=Room[Fig].Exit[North];
      if(test=='e') NewDirection=Room[Fig].Exit[East];
      if(test=='s') NewDirection=Room[Fig].Exit[South];
      if(test=='w') NewDirection=Room[Fig].Exit[West];
      if(test=='q') NewDirection=99;
      
      if(NewDirection!=0) return(NewDirection);
      printf("\n\nYou cannot go that way, there must be another path to take.");
     }
    }
    void SetupRooms(){
    //ROOM 1
    strcpy(Room[1].RoomName, "Outside");
    strcpy(Room[1].Description, "\n\nHis eyes slowly rested back upon the house. Its unkept walls wore a thin green\ncoat of algae.");
    strcpy(Room[1].Description2, "\nThe trees produced shadows, dancing along the empty flower beds as a slow wind\nkissed the top of the branches. It looked sorry, lonely, friendly.\n\n");
    Room[1].Exit[North]=2;  
    Room[1].Exit[East]=0;  
    Room[1].Exit[West]=0;  
    Room[1].Exit[South]=0;  
    //ROOM 2
    strcpy(Room[2].RoomName, "Entrance");
    strcpy(Room[2].Description, "\n\nHe was greeted by a wide staircase, covered in what would have been a plush,\nwhite carpet.");
    strcpy(Room[2].Description2, "\nHis eyes were drawn up the stairs but his better judgment told him to look\naround the ground floor first.\n\n");
    Room[2].Exit[North]=7;  
    Room[2].Exit[East]=4;  
    Room[2].Exit[West]=3;  
    Room[2].Exit[South]=1;  
    //ROOM 3
    strcpy(Room[3].RoomName, "Office");
    strcpy(Room[3].Description, "\n\nHe slowly edged the door open, his left hand resting on the top of the blade\nhanging naturally off his hip.");
    strcpy(Room[3].Description2, "\nThe chair lay helplessly on the floor, paper strewn around its base. The room\nbore nothing of interest.\n\n");
    Room[3].Exit[North]=0;  
    Room[3].Exit[East]=2;  
    Room[3].Exit[West]=0;  
    Room[3].Exit[South]=0;  
    //ROOM 4
    strcpy(Room[4].RoomName, "Small Hallway 1");
    strcpy(Room[4].Description, "\n\nOn the other side of the hallway he came across two doors. The one to his left\nwas ajar, the other closed tightly.");
    strcpy(Room[4].Description2, "\nThe small hallway brought him a feeling of both comfort and clostrophobia.\n\n");
    Room[4].Exit[North]=5;  
    Room[4].Exit[East]=6;  
    Room[4].Exit[West]=2;  
    Room[4].Exit[South]=0;  
    //ROOM 5
    strcpy(Room[5].RoomName, "Downstairs Bathroom");
    strcpy(Room[5].Description, "\n\nThe room was the same as the day it was left. It was not big, or luxurious, but instead a reminder of what had been.");
    strcpy(Room[5].Description2, "\nHe spent a minute searching the shelves, but a man in his position found little use for aftershave.\n\n");
    Room[5].Exit[North]=0;  
    Room[5].Exit[East]=0;  
    Room[5].Exit[West]=0;  
    Room[5].Exit[South]=4;  
    //ROOM 6
    strcpy(Room[6].RoomName, "Downstairs Bedroom");
    strcpy(Room[6].Description, "\n\nThe cream walls adorned with posters, pictures and memories all suggested that\nof a youth");
    strcpy(Room[6].Description2, "\nA double bed lay half dressed with belongings hurriedly strewn across it.\nMusical instruments, a guitar, a drum set.\n\n");
    Room[6].Exit[North]=0;  
    Room[6].Exit[East]=0;  
    Room[6].Exit[West]=4;  
    Room[6].Exit[South]=0; 
    //ROOM 7 
    strcpy(Room[7].RoomName, "Landing");
    strcpy(Room[7].Description, "\n");
    strcpy(Room[7].Description2, "\n");
    Room[7].Exit[North]=11;  
    Room[7].Exit[East]=9;  
    Room[7].Exit[West]=8;  
    Room[7].Exit[South]=2;
    //ROOM 8
    strcpy(Room[8].RoomName, "Living Room");
    strcpy(Room[8].Description, "\nBLAH\n\n");
    Room[8].Exit[North]=0;  
    Room[8].Exit[East]=7;  
    Room[8].Exit[West]=0;  
    Room[8].Exit[South]=0; 
    //ROOM 9
    strcpy(Room[9].RoomName, "Kitchen");
    strcpy(Room[9].Description, "\nBLAH\n\n");
    Room[9].Exit[North]=0;  
    Room[9].Exit[East]=10;  
    Room[9].Exit[West]=7;  
    Room[9].Exit[South]=0;
    //ROOM 10
    strcpy(Room[10].RoomName, "Utility Room");
    strcpy(Room[10].Description, "\nBLAH\n\n");
    Room[10].Exit[North]=0;  
    Room[10].Exit[East]=0;  
    Room[10].Exit[West]=9;  
    Room[10].Exit[South]=0;  
    //ROOM 11
    strcpy(Room[11].RoomName, "Upstairs Hallway");
    strcpy(Room[11].Description, "\nBLAH\n\n");
    Room[11].Exit[North]=13;  
    Room[11].Exit[East]=14;  
    Room[11].Exit[West]=12;  
    Room[11].Exit[South]=7;  
    //ROOM 12 
    strcpy(Room[12].RoomName, "Bedroom 1");
    strcpy(Room[12].Description, "\nBLAH\n\n");
    Room[12].Exit[North]=0;  
    Room[12].Exit[East]=11;  
    Room[12].Exit[West]=0;  
    Room[12].Exit[South]=0;  
    //ROOM 13 
    strcpy(Room[13].RoomName, "Bedroom 2");
    strcpy(Room[13].Description, "\nBLAH\n\n");
    Room[13].Exit[North]=0;  
    Room[13].Exit[East]=0;  
    Room[13].Exit[West]=0;  
    Room[13].Exit[South]=11; 
    //ROOM 14
    strcpy(Room[14].RoomName, "Upstairs Bathroom");
    strcpy(Room[14].Description, "\nBLAH\n\n");
    Room[14].Exit[North]=0;  
    Room[14].Exit[East]=0;  
    Room[14].Exit[West]=11;  
    Room[14].Exit[South]=0;   
    //ROOM 15
    strcpy(Room[15].RoomName, "Introduction");
    strcpy(Room[15].Description, "\n\n%s stood in the centre of the road, fully aware of this shadowed eyes and \nslumped shoulders.");
    strcpy(Room[15].Description2,"\nThe chill of night pinched his skin and woke him from his thoughts.\n\n");
    Room[15].Exit[North]=1;  
    Room[15].Exit[East]=0;  
    Room[15].Exit[West]=0;  
    Room[15].Exit[South]=0;   
    
    }

  15. #15
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    edit: Good timing. I'll take a look at it.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. username to uid
    By chrismiceli in forum Linux Programming
    Replies: 1
    Last Post: 07-30-2007, 01:23 PM
  2. Birthyear in username? Why?
    By brewbuck in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-28-2007, 06:48 PM
  3. username collection
    By algi in forum C++ Programming
    Replies: 3
    Last Post: 01-22-2005, 01:20 PM
  4. Username function
    By jamie85 in forum C Programming
    Replies: 6
    Last Post: 03-19-2004, 06:33 PM
  5. getting username from Windows NT
    By Flucas in forum Windows Programming
    Replies: 1
    Last Post: 10-29-2001, 06:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21