OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Ridding TEdit  control of extraneous characters

Date: 12/1/99
Time: 10:39:38 PM

Question:

I'm having a problem with input fields using a Windows dialog.
The input length and end of data is filled with extraneous characters
I don't know where they're coming from. I'm using GetText and
SetText as well as
Pfname = new TEdit(this,IDC_NAME,35 + 1);
Pfname->SetText(this->record1.buff[0].pfname);
Pfname->GetText(record1.buff[0].pfname,35 + 1);

Answer:

OWL uses the Windows function GetWindowText(),
which doesn't set the trailing '\0'. You have to set it manually,
using the number of chars actually read (returned by GetText()).

Last changed: July 14, 2001