Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
859 B

  1. //-----------------------------------------------------------------------------
  2. // txttohtm.h
  3. //-----------------------------------------------------------------------------
  4. #ifndef _TXTTOHTM_H
  5. #define _TXTTOHTM_H
  6. #define PRE_TAG _T("<pre>")
  7. #define PRE_ENDTAG _T("</pre>")
  8. inline HRESULT FinishTextToHTML(LPCTSTR szFinishText, LPTSTR * pszHtmlText)
  9. {
  10. if (!szFinishText || !pszHtmlText)
  11. {
  12. return E_POINTER;
  13. }
  14. HRESULT hr = S_OK;
  15. *pszHtmlText = new TCHAR[_tcslen(szFinishText) + _tcslen(PRE_TAG) + _tcslen(PRE_ENDTAG) + 1];
  16. if (*pszHtmlText)
  17. {
  18. _tcscpy(*pszHtmlText, PRE_TAG);
  19. _tcscat(*pszHtmlText, szFinishText);
  20. _tcscat(*pszHtmlText, PRE_ENDTAG);
  21. }
  22. else
  23. {
  24. hr = E_OUTOFMEMORY;
  25. }
  26. return hr;
  27. }
  28. #endif // _TXTTOHTM_H