Confused in abby
-
Dear Forum, Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the
TRACE
call does manage to successfully out put it?for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
{
CString str = _T("");
if (pConfig->IncludeComputer)
{
str += (*it)->ComputerName;
str += _T(" : ");
}
if (pConfig->IncludeTable)
{
TRACE("*%s*\n", (*it)->TableName); // TableName successfully TRACEd
str += (*it)->TableName; // Why TableName not added to string????
str += _T(" : ");
}
str += (*it)->SampleName;
m_ListSelected.AddString(str);
}After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed" and the TRACE output is: "*743 Daily*". str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed" I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button:~ [edit] ComputerName, Tablename, and SampleName are all CStrings. [/edit] Signed Confused in abby
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
-
Dear Forum, Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the
TRACE
call does manage to successfully out put it?for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
{
CString str = _T("");
if (pConfig->IncludeComputer)
{
str += (*it)->ComputerName;
str += _T(" : ");
}
if (pConfig->IncludeTable)
{
TRACE("*%s*\n", (*it)->TableName); // TableName successfully TRACEd
str += (*it)->TableName; // Why TableName not added to string????
str += _T(" : ");
}
str += (*it)->SampleName;
m_ListSelected.AddString(str);
}After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed" and the TRACE output is: "*743 Daily*". str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed" I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button:~ [edit] ComputerName, Tablename, and SampleName are all CStrings. [/edit] Signed Confused in abby
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
-
I don't have a clue, but have you tried casting the TableName to f.e. (char *) or something alike..? I wouldn't be amazed if it was some sort of type-confusion..
-
hmmm. That worked. wierd:confused: Thanks a lot:-D.
[
](http://www.canucks.com)Sonork 100.11743 Chicken Little "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 Within you lies the power for good - Use it!
Its because your mixing crappy old MFC CString and lovely new STL, you naughty boy you.:-D Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com