Thread: getting username from Windows NT

  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
    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, 01:19 AM
  3. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07: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