Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Regarding Path of MS outlook in various languages of windows Pin
Michael Dunn20-Feb-06 11:04
sitebuilderMichael Dunn20-Feb-06 11:04 
QuestionUnicode data in Reg.dll Pin
meet2nishith20-Feb-06 1:38
meet2nishith20-Feb-06 1:38 
QuestionOptical Character recognition(OCR) Pin
Ankush Mehta20-Feb-06 1:22
Ankush Mehta20-Feb-06 1:22 
AnswerRe: Optical Character recognition(OCR) Pin
Cedric Moonen20-Feb-06 2:21
Cedric Moonen20-Feb-06 2:21 
QuestionAdding ATL Support to MFC Extension DLLs? Pin
a_kiani20-Feb-06 1:14
a_kiani20-Feb-06 1:14 
QuestionQUERY: strip trailing whitespace ... woes :S Pin
kevingpo20-Feb-06 1:13
kevingpo20-Feb-06 1:13 
AnswerRe: QUERY: strip trailing whitespace ... woes :S Pin
David Crow20-Feb-06 2:48
David Crow20-Feb-06 2:48 
AnswerRe: QUERY: strip trailing whitespace ... woes :S Pin
Wim Engberts20-Feb-06 3:14
Wim Engberts20-Feb-06 3:14 
See following code:

main (....)
{

CString strPath = "*.*";
Trim (strPath);
}

void Trim (CString &strPath)
{
CFileFind Info;
CStdioFile File;
CString strRecord;
BOOL bLoop;

bLoop = Info.FindFile ((LPCTSTR)strPath, 0);
while (bLoop)
{
bLoop = Info.FindNextFile ();
if ( Info.IsDirectory ()
&& !Info.IsDots ())
{
CString strSub;

strSub = Info.GetFilePath ();
strSub += "\\*.*";
Strip (strSub);
}
else if ( !Info.IsDirectory ()
&& !Info.IsHidden ()
&& !Info.IsReadOnly ())
{
printf ("%s\n",(LPCTSTR)Info.GetFilePath ());
if (File.Open ((LPCTSTR)Info.GetFilePath (), CFile::modeReadWrite|CFile::typeBinary, NULL))
{
DWORD dwReadPosition = 0;
DWORD dwWritePosition = 0;
UINT nRecord = 0;

try
{
while (File.ReadString (strRecord))
{
dwReadPosition = File.GetPosition ();
strRecord.TrimRight ();
File.Seek (dwWritePosition, CFile::begin);
File.WriteString ((LPCTSTR)strRecord);
File.WriteString ("\r\n");
dwWritePosition = File.GetPosition ();
File.Seek (dwReadPosition, CFile::begin);
printf ("%d\r",++nRecord);
}
printf ("\n");
}
catch (CFileException *Exception)
{
Exception->Delete ();
fprintf (stderr,"\nError writing to file\n");
File.Close ();
exit (1);
}
File.SetLength (dwWritePosition);
File.Close ();
}
}
}
}

This code example expects you use MFC. If you don't, you will have to use the standard FILE * type of routines.

Good luck.

William
QuestionCompiler Pin
Subramaniam s.V.20-Feb-06 0:41
Subramaniam s.V.20-Feb-06 0:41 
AnswerRe: Compiler Pin
Waldermort20-Feb-06 0:56
Waldermort20-Feb-06 0:56 
GeneralRe: Compiler Pin
David Crow20-Feb-06 2:54
David Crow20-Feb-06 2:54 
AnswerRe: Compiler Pin
Rage20-Feb-06 1:06
professionalRage20-Feb-06 1:06 
AnswerRe: Compiler Pin
BadKarma20-Feb-06 1:06
BadKarma20-Feb-06 1:06 
GeneralRe: Compiler Pin
Maximilien20-Feb-06 2:52
Maximilien20-Feb-06 2:52 
GeneralRe: Compiler Pin
Prakash Nadar20-Feb-06 3:56
Prakash Nadar20-Feb-06 3:56 
Questionresource (.rc) files Pin
Waldermort19-Feb-06 23:53
Waldermort19-Feb-06 23:53 
AnswerRe: resource (.rc) files Pin
Dan McCormick20-Feb-06 2:55
Dan McCormick20-Feb-06 2:55 
GeneralRe: resource (.rc) files Pin
Waldermort20-Feb-06 4:05
Waldermort20-Feb-06 4:05 
QuestionRe: resource (.rc) files Pin
David Crow20-Feb-06 2:56
David Crow20-Feb-06 2:56 
AnswerRe: resource (.rc) files Pin
Waldermort20-Feb-06 4:02
Waldermort20-Feb-06 4:02 
QuestionEmail application from VC++ Pin
RamL19-Feb-06 23:17
RamL19-Feb-06 23:17 
AnswerRe: Email application from VC++ Pin
Ganesh_T20-Feb-06 2:24
Ganesh_T20-Feb-06 2:24 
AnswerRe: Email application from VC++ Pin
oshah20-Feb-06 2:45
oshah20-Feb-06 2:45 
QuestionHow Restart Remote Computer? Pin
M.Mehrdad.M19-Feb-06 23:02
M.Mehrdad.M19-Feb-06 23:02 
AnswerRe: How Restart Remote Computer? Pin
Gavin Taylor19-Feb-06 23:17
professionalGavin Taylor19-Feb-06 23:17 

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.