Solved

Open File Please Help

Posted on 2000-04-13
3
185 Views
Last Modified: 2010-04-02
I need to know how to read data from atext file and display it
in Single Document Interface by using MFC in Visual c++.
0
Comment
Question by:catdaddy123
3 Comments
 
LVL 1

Expert Comment

by:MT_MU
ID: 2713614
The method with the least coding...

Use app wizard to create a SDI application.

When the Wizard gets to the step where it shows the classes it is about to create for you - Select the "view" class and change it's base class to CEditView.

0
 
LVL 6

Expert Comment

by:graham_k
ID: 2714242
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 2714554
Look at the Multipad sample in MFC.

It is a MDI example, but shows you how to read and write the text file etc.  In particular, look at the document class which has only one function overriden to do this:

void CPadDoc::Serialize(CArchive& ar)
{
  ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
}

Then use AppWizard to create an SDI document/view app with the view based on CEDitView.

Make the appropriate changes/additions as per MultiPad for reading and writing the file (like the above), and you're done.

You might also then want to add a toolbar as in Multipad.

Then, when you've had enough of that .. look at SuperPad, which adds a heap of functionality to give you a really nice text editor.

here are the extra that SuperPad shows you how to do:
>About dialog box showing system resource usage.
>Splash window that is displayed when the application first starts.
>Persistent window placement by storing window position information in a private .ini file.
>Idle loop processing.
>Using a wait cursor.
>Subclassing a window.
>Adding page headers and footers during printing.
>Page breaking during printing.
>Starting print preview at the current selection in the document.
>Returning from print preview to the same position in the document as last previewed.
> Standard font dialog box (CFontDialog).

PS: This question really belongs in the MFC area.

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now