Solved

Open File Please Help

Posted on 2000-04-13
3
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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. …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

626 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