Save to .tmp file???

How do I take the value of Edit1 and save it to a .tmp file???

thanks.
LVL 1
stevenc317Asked:
Who is Participating?
 
q2guoConnect With a Mentor Commented:
ofstream OUTFILE("temp.tmp",ios::out);  // open file for                                                 // writing
OUTFILE << edit1;
OUTFILE.close();

By the way, what is edit1;
0
 
stevenc317Author Commented:
It is not working.  I may need to include some headers, which should I use??  Also I have one more quick question.  What do I do so that I can display the contents??
0
 
q2guoCommented:
#include <fstream.h>

What compiler are you using?
Are you programming in windows or dos?
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
stevenc317Author Commented:
I am using Borland C++ Builder v1.0 (standard) for Win95.  It now works, but it is saving the information in hex.

how do I get it to be saved as ASCII???
0
 
q2guoCommented:
hex??  What are you trying to save?  What is 'edit1' in you
questioN?
0
 
stevenc317Author Commented:
Edit1 (it is really Edit2, I made an error when I asked the question) anyway, it is a text blank. Just like the one you use to increase the points in Experts Exchange.
0
 
q2guoCommented:
Are you using visual C++?
0
 
stevenc317Author Commented:
I am using Borland C++ Builder v1.0 for Win95
0
 
q2guoCommented:
So, edit2 is actually a editbox.
No wonder you were getting hex in the temp file.
Now, I have never used Borland C++ builder before.
But, there must be a member function that you can call
which will return the contain of the editbox.
Look up help in your Borland C++ builder under member function
of an editbox

assume the function is called getContent.

This is how you call it
OUTFILE << edit2.getContent();



0
 
stevenc317Author Commented:
error message..
[C++ Error] Options.cpp(24): Structure requires on left side of. or .*.

I used the following codes (that made that error)...


ofstream OUTFILE("temp.tmp",ios::out); // open file for writing
  OUTFILE << Edit2.getContent();
  OUTFILE.close();
0
 
q2guoCommented:
I was just giving you an example.  getContent() is not
a member function.  You should look up help for the actual
function.
0
 
stevenc317Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.