Click here to Skip to main content
15,908,901 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSymbol Name problem/question Pin
18-Nov-00 6:40
suss18-Nov-00 6:40 
GeneralRight Mouse Button Pin
18-Nov-00 4:18
suss18-Nov-00 4:18 
GeneralRe: Right Mouse Button Pin
Christian Graus19-Nov-00 12:37
protectorChristian Graus19-Nov-00 12:37 
GeneralExplanation for screen capture Pin
18-Nov-00 1:49
suss18-Nov-00 1:49 
Generaldeleting a pointer Pin
DanYELL17-Nov-00 14:32
DanYELL17-Nov-00 14:32 
GeneralRe: deleting a pointer Pin
Michael Dunn17-Nov-00 14:44
sitebuilderMichael Dunn17-Nov-00 14:44 
GeneralRe: deleting a pointer Pin
DanYELL17-Nov-00 15:21
DanYELL17-Nov-00 15:21 
GeneralRe: deleting a pointer Pin
Michael Dunn17-Nov-00 15:40
sitebuilderMichael Dunn17-Nov-00 15:40 
Sure! Smile | :)
// TrimLeft() : trims all whitespace from the beginning of a string.
// Params: szOrigStr - string to trim
//         szOutputStr - output buffer
//         uBuffSize - buffer size, in characters
// Return: TRUE on success, FALSE if the buffer is too small
 
bool TrimLeft ( LPCTSTR szOrigStr, LPTSTR szOutputStr, UINT uBuffSize )
{
int i = 0;

  while ( isspace( szOrigStr[i] ))
    i++;

  if ( uBuffSize < (lstrlen(szOrigStr) - i + 1) )
    return false;

  lstrcpy ( szOutputStr, &szOrigStr[i] );

  return true;
}


You'd call it thus:
{
TCHAR szOrigStr[] = _T("    foobar");
TCHAR szTrimmedStr[64];

  TrimLeft ( szOrigStr, szTrimmedStr, 64 );
}


That way, the caller has control over the buffer. Most of the Windows APIs do it this way, so programmers are comfortable with it.

--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
QuestionHOW TO GET NET SEND ERROR MESSAGE ?? Pin
17-Nov-00 11:59
suss17-Nov-00 11:59 
GeneralBasics Pin
17-Nov-00 3:26
suss17-Nov-00 3:26 
GeneralRe: Basics Pin
17-Nov-00 8:48
suss17-Nov-00 8:48 
GeneralRe: Basics Pin
18-Nov-00 19:47
suss18-Nov-00 19:47 
GeneralRe: Basics Pin
18-Nov-00 19:47
suss18-Nov-00 19:47 
General:confused: How to copy a file in clipboard Pin
17-Nov-00 0:10
suss17-Nov-00 0:10 
QuestionHow to change window caption font Pin
Chris Vischer17-Nov-00 0:08
Chris Vischer17-Nov-00 0:08 
AnswerRe: How to change window caption font Pin
jerry0davis17-Nov-00 4:59
jerry0davis17-Nov-00 4:59 
AnswerRe: How to change window caption font Pin
17-Nov-00 8:50
suss17-Nov-00 8:50 
GeneralHide the scrollbars of a CTreeCtrl object Pin
Tran Hoang Chuong16-Nov-00 23:17
Tran Hoang Chuong16-Nov-00 23:17 
GeneralRe: Hide the scrollbars of a CTreeCtrl object Pin
SudhaShriram17-Nov-00 0:05
SudhaShriram17-Nov-00 0:05 
GeneralView with look like Outlook Today Page Pin
16-Nov-00 22:02
suss16-Nov-00 22:02 
GeneralRe: View with look like Outlook Today Page Pin
17-Nov-00 8:54
suss17-Nov-00 8:54 
GeneralExport registry settings Pin
15-Nov-00 21:17
suss15-Nov-00 21:17 
GeneralRe: Export registry settings Pin
20-Nov-00 4:24
suss20-Nov-00 4:24 
GeneralCreate Virtual Disk at RAM Pin
15-Nov-00 20:51
suss15-Nov-00 20:51 
QuestionProtection against disassemblers? Pin
15-Nov-00 13:13
suss15-Nov-00 13:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.