Can someone help me translate this from VB to C++?
VB Code:
  1. ' Visual Basic version
  2. Public Function LineTrim(Expression As String) As String
  3. 'Remove trailing CRs and LFs
  4.     Dim sReturn As String
  5.     Dim sCheck As String
  6.    
  7.     sReturn = Expression
  8.    
  9.     sCheck = Right(sReturn, 1)
  10.  
  11.     Do While (sCheck = Chr(10)) Or (sCheck = Chr(13))
  12.         sReturn = Left(sReturn, Len(sReturn) - 1)
  13.         sCheck = Right(sReturn, 1)
  14.     Loop
  15.    
  16.     LineTrim = sReturn
  17.    
  18. End Function

and now the C++ version, which will be in a DLL for VB

Code:
LPCSTR LineTrim(LPCSTR *Expression)
{
     // I dont want to alter the original string,
     // so I need to declare this return value correct?
     LPCSTR ReturnVal;

     // How can I move the pointer to the end of the LPCSTR
     // without looping through it until '/0'

     // How can I check for the ascii value of the current char,
     // and shorten the string if it's CR or LF?

     LineTrim = ReturnVal;
}