Question about 'GetDlgItemText()'

Started by
0 comments, last by Dookie 17 years, 8 months ago
Hello, it's me. Again. Dang I have a lot of questions today! [grin] This one is really hard to describe, so I hope you can understand what I'm trying to do. I'm trying to use 'GetDlgItemText' to get the text out of an edit control in my dialog box. But when I call it, it doesn't NULL terminate the string at the end of the text; rather, it NULL terminates it at my hard-set limit for GetDlgItemText. For example, char TextData[32]; ZeroMemory( TextData, sizeof(TextData) ); (type "Hi there!" in the edit control labeled 'IDC_TXT_DATA') GetDlgItemText(hDlg, IDC_TXT_DATA, TextData, 16); TextData would be NULL at the 16th array element because I told GetDlgItemText to only read in 16 characters. It is not NULL at element 9, which is the end of the sentence "Hi there!". How do I read text out of an edit control, and make it so the length of the text itself determines where the NULL starts in the character array? Thanks in advance for the help!
"The crows seemed to be calling his name, thought Caw"
Advertisement
Nevermind, I was space-terminating the string in one part of my program rather than looking for the start of the NULL. Doh! Anyhoo, I added a space (char 32) to the end of the string and now works in my program.

If you're a moderator and you're reading this, you can delete this thread when you get done laughing. [wink]
"The crows seemed to be calling his name, thought Caw"

This topic is closed to new replies.

Advertisement