Thread: Problem when printing to text file

  1. #1

    Post Problem when printing to text file

    I am currently having problems trying to print successfully to a text file via the

    GetDlgItemText(hWnd, NAME, name, sizeof(name) / sizeof(TCHAR));

    function. I have declared a TCHAR name[36] variable, and every time the function is executed above it prints out this

    面面面面面面面面面面面面面面面面面面面面面面面面面 面面面面面面面面面DWRER

    DWRER being a relative response. Does anyone know what could be wrong?

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001

    I think the problem is in the last param of the function.

    TCHAR name[36]; //this is the buffer for the text to be stored in
    //now execute the function
    GetDlgItemText(hWnd, NAME, name, sizeof(name));
    Thats how everything should look and that should work, the only other thing i can think of is that 36 chars may not be big enough to hold the string or maybe it is?, also make sure you are using this code inside your dialog proc function so you have the right handle for the first parameter (hwnd). And if it still dosnt work then im not sure but check that NAME is the correct ID and everything.... but as i say i think the code i gave you should fix it.

    Hope thats of some help,
    You Can Stop Me, But You Cant Stop Us All

  3. #3

    that seems to have fixed the problem, thanks a lot :)

    damn, ive nothing to say now that ive said it all in the subject


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reading a text file printing line number
    By bazzano in forum C Programming
    Replies: 4
    Last Post: 09-16-2005, 10:31 AM
  2. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM