# CustomString Sample: Demonstrates Custom Memory Allocators for CStringT

The CustomString sample shows how to use a custom memory allocator for CStringT to improve performance in a multithreaded application. The sample application replaces carriage return/line feed pairs in a set of text files with a single carriage return, processing multiple files simultaneously on different threads.

Security Note
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.

# Building and Running the Sample

#### To build and run this sample

1. Open the solution file CustomString.sln.

2. From the Build menu, click Build Solution.

3. To run the sample from a command prompt, type CustomString *.txt. The sample will find all files in the current directory with ".txt" as the file extension and will create a copy of each file with ".utxt" as the file extension. The new files will have all CR/LF pairs replaced with a single CR.

4. To run the sample from within Visual Studio, right-click the solution and click Properties on the shortcut menu. Under Configuration Properties. select Debugging, and set the command-line argument property to "*.txt" for the correct configuration.

# Classes and Keywords

This sample uses the following classes:

IAtlStringMgr; CWin32Heap; CAtlStringMgr; CStringT

This sample uses the following keywords:

CBitmap::LoadBitmap; CEdit::Clear; CEdit::GetLineCount; CEdit::LineIndex; CEdit::LineLength; CEdit::ReplaceSel; CEdit::SetSel; CFileDialog::DoModal; CFileDialog::GetPathName; CGdiObject::DeleteObject; CSpinButtonCtrl::GetBuddy; CString::GetBufferSetLength; CString::GetLength; CString::Left; CString::LoadString; CString::ReleaseBuffer; CWinApp::LoadIcon; CWnd::GetClientRect; CWnd::GetWindowRect; CWnd::SetWindowPos; CWnd::SetWindowText; DeleteItem; CWnd::DestroyWindow; CWnd::EnableWindow; GetCursorPos; GetDlgItem; GetParent; GetWindowLong; GetWindowRect; InvalidateRect; LoadIcon; MAKELONG; MessageBeep; ReleaseCapture; ScreenToClient; SetCapture; SetWindowLong; SetWindowPos; UpdateWindow; WindowProc; mbstowcs; rand; srand; time; wsprintf