Thread: garbled output: Win32 : GetLogicalDriveStrings()

  1. #1

    garbled output: Win32 : GetLogicalDriveStrings()

    why do i get garbled output from this:

    BOOL getLogicalNames(char *psDriveBuffer, DWORD nBufLen)
    DWORD nRes;
    printf("Getting Logical Names\n");

    if ( (nRes = GetLogicalDriveStringsA (nBufLen, psDriveBuffer) )== 0 )
    return FALSE;
    printf("%d, %s", nRes, psDriveBuffer);
    return TRUE;

  2. #2
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Post this kind of stuff on the Windows Programming Board.

  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    What length have you allocated to the psDriveBuffer?

    Are you using UNICODE (char is 2 bytes not one)?

    Is nRes > sizeof(psDriveBuffer) when function returns?

    What does GetLastError() return?

    (Is GetLogicalDriveStringsA() a typo? Should be GetLogicalDriveStrings() )

    I would get the return from the GetLogicalDriveStrings eg nRes and then test
    sprintf(sBuffer,"GetLogicalDriveStringsA failed with error#%d.",iError);
    return FALSE;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code output...
    By roaan in forum C Programming
    Replies: 6
    Last Post: 07-03-2009, 02:22 AM
  2. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  3. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  4. Trying to store system(command) Output
    By punxworm in forum C++ Programming
    Replies: 5
    Last Post: 04-20-2005, 06:46 PM
  5. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 05:57 PM