Info:
OS Developed on Ubuntu Linux
using gcc, ld and nasm
I have the following type of structure defined:
Code: Select all
typedef struct userinfo
{
char *username;
unsigned int rights;
unsigned int lastloggedin;
unsigned int locked;
} USERINFO;
Code: Select all
int main (void)
{
USERINFO *userlogin;
userlogin = openfile("user.nfo");
printf (userlogin->username);
printf ("User rights: %d",userlogin->rights);
printf ("User last logged in: %d",userlogin->lastloggedin);
printf ("User rights: %d",userlogin->rights);
printf ("Is the user locked out?: %d",userlogin->locked);
}
The issue that I am having is with displaying the username. When I printf the username I either get nothing or I get garbage. I have no problems with the data for the other members of the struct.
I have written an elf executable written in c that I used to create the file user.nfo. I have also made a test program written in c that I used to see if I can read back the same data that I wrote into my user.nfo file These actions where done under linux. The tests show that under linux I am able to get back the data that I wrote to the user.nfo file and can access all data elements of the struct USERINFO but this is not true with all elements under my OS as described above.
Any ideas with this or help is much appreciated.