getting username from Windows NT

This is a discussion on getting username from Windows NT within the Windows Programming forums, part of the Platform Specific Boards category; Does anyone know the code to get the current username of the Windows NT system. eg. if my username is ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    18

    Arrow getting username from Windows NT

    Does anyone know the code to get the current username of the Windows NT system. eg. if my username is s98132, how do I get that in my prog.

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    CHAR name[256];
    ULONG size = sizeof(name);
    GetUserName(name,&size);

    name will contain the current user name.
    zen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Perfect number and divisors
    By Lissa in forum C Programming
    Replies: 31
    Last Post: 10-24-2008, 01:36 PM
  2. Windows NT?
    By NecroFromHell in forum C++ Programming
    Replies: 3
    Last Post: 02-17-2006, 12:19 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. Dos differences in Windows NT and Windows XP
    By Ruchikar in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 09-17-2003, 11:36 PM

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