15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Converting \n to \r\n in CEditView

Kenytt Avery -- kavery@ecs.fullerton.edu
Tuesday, August 13, 1996

Environment:  VC++ 4.0 / Win 95

I have an editor based on CEditView, and I'm trying to read in some files 
that originated on a UNIX box.  Of course, they're separated by newlines 
rather than CRLF's.

Obviously, I can read in the file and replace the \n's, or I can read the 
file in line by line and insert it into the edit control.  But what's the 
"right" way to do this?  I tried overriding CDocument::GetFile() to 
return a CStdioFile, but it dies with an assertion.

---
Kenytt Avery (kavery@titan.fullerton.edu)
MFC Programmer, permanently chained to a WinTel box
"Too much overhead, not enough threads!" (tm)
Warning:  Anyone using the phrase "Info-bahn" will be summarily executed.




Deepak Saxena -- Deepak_Saxena@ccm.ch.intel.com
Thursday, August 15, 1996


Text item: 


override CDocument::OpenDocumentFile()


______________________________ Reply Separator _________________________________
Subject: Converting \n to \r\n in CEditView
Author:  owner-mfc-l@netcom.com at SMTPGATE
Date:    8/13/96 10:58 PM


Environment:  VC++ 4.0 / Win 95

I have an editor based on CEditView, and I'm trying to read in some files
that originated on a UNIX box.  Of course, they're separated by newlines
rather than CRLF's.

Obviously, I can read in the file and replace the \n's, or I can read the
file in line by line and insert it into the edit control.  But what's the
"right" way to do this?  I tried overriding CDocument::GetFile() to
return a CStdioFile, but it dies with an assertion.

---
Kenytt Avery (kavery@titan.fullerton.edu)
MFC Programmer, permanently chained to a WinTel box
"Too much overhead, not enough threads!" (tm)
Warning:  Anyone using the phrase "Info-bahn" will be summarily executed.




Kenytt Avery -- kavery@ecs.fullerton.edu
Saturday, August 17, 1996

Originally, I asked

>> . . . what's the "right" way to do this?  I tried overriding 
>> CDocument::GetFile() to return a CStdioFile, but it dies with an 
>> assertion.

On Thu, 15 Aug 1996, Deepak Saxena wrote:

> override CDocument::OpenDocumentFile()

*This* I know.  (I did pretend to be a competent MFC programmer long
enough to subscribe to the list, after all.)  When I say "right", I guess
what I mean is "using as little of my own code and as much of MFC's as
possible."

At any rate, I do have a nice little solution that overrides 
CDocument::GetFile(), reads the file into a buffer using 
CStdioFile::ReadString(), and returns a CMemFile, if anyone is interested 
in seeing it. . .

---
Kenytt Avery (kavery@titan.fullerton.edu)
MFC Programmer, permanently chained to a WinTel box
"Too much overhead, not enough threads!" (tm)
Warning:  Anyone using the phrase "Info-bahn" will be summarily executed.





| Вернуться в корень Архива |