Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab stripping

Status
Not open for further replies.

RobertSBoyle

Programmer
Feb 21, 2001
16
0
0
EU
Hi there,
I am in a bit of stushi at the moment. I am an Oracle developer who has done a little pro*C in his time but have been asked to look at a c++ program that needs to have a bug removed as the guy who wrote it has left and the other c++ guy is on holiday (wish is were me ;oP)

Ok, problem is this, we have text coming in and we need to strip off any tab characters and whitespace. Easy enough except for this, the variable the text is in is like the following (the stripping code would go before this if clause):

if (StrCmp (abValue->m_szName, "BLAHBLAH") == 0)

I am unsure what abValue->m_szName corresponds to. I have looked at MSDN and think it has something to do with classes? In which case I am totally lost as I have no OOP's experience at all. If it were in a simple string I could just loop through the string and remove all '\t' etc but I can't seem to get it to go into a string variable. When I try to copy in a strncpy I get the error:

error C2664: 'strncpy' : cannot convert parameter 1 from 'char' to 'char *'

Thanks in advance for any help.
Cheers
R.
 
CString tabRemover;

tabRemover = "\t\t\2 tabs\t\t\tfollowed by 3 tabs";
tabRemover.Remove('\t');

That should do it

matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top