Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open File Please Help

Posted on 2000-04-13
3
Medium Priority
?
250 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 200 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

972 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