|
-
September 1st, 1999, 02:16 AM
#1
Reading in a file
I'm new so bare with me...
I have to read in a file which comprises an 3 columns of numbers, an x a y and a firction. ie
60.5673 45.6723 3.5
etc
So I'm not sure how to start should I be looking at CFile to read the file in?!? Or can it be done through the Serialize function of an SDI application?!?
I think i'm confused about the difference between the two... Is Serialize for just for saving changes to a document?!? SO when a user minimises the view and then brings it back the contents(say a drawing app) are still there?!?
thanks in advance
Boom
-
September 1st, 1999, 02:25 AM
#2
Re: Reading in a file
What do you mean by "reading in"? are you talkin' about displaying it in a veiw? if not, I would go with CFile...
-
September 1st, 1999, 02:50 AM
#3
Re: Reading in a file
I need to read/load the numbers from an ASCII text file, into a data structure. From there I have to 1 display it prolly as a bitmap, then run an algorithm on it to create polygon outliones then display these. So I guess my question is to read in from a file into a data structure should I use CFile?!?
-
September 1st, 1999, 03:02 AM
#4
Re: Reading in a file
yeah... go with CFile..
look in the help at CFile's class members fer help on that...
-
September 1st, 1999, 05:15 AM
#5
Re: Reading in a file
Hi, maybe this part of code can help yuo:
CString infoPath = m_Drive + "filename_and_path';
CString enter = "\r\n"; // linefeed/carriage return invoegen
CStdioFile file;
if (!file.Open (infoPath, CFile::modeRead))
{
AfxMessageBox ("Kan " + infoPath + " niet openen!");
m_text.SetWindowText ("");
}
else
{
CString buf, inhoud = "";
while (file.GetPosition() < file.GetLength())
{
file.ReadString (buf);
inhoud += (buf + enter);
}
m_text.SetWindowText (inhoud);
file.Close();
}
bye, Dick
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|