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
Solved

Save to .tmp file???

Posted on 1998-02-08
12
254 Views
Last Modified: 2010-04-10
How do I take the value of Edit1 and save it to a .tmp file???

thanks.
0
Comment
Question by:stevenc317
  • 6
  • 6
12 Comments
 
LVL 3

Accepted Solution

by:
q2guo earned 20 total points
ID: 1181344
ofstream OUTFILE("temp.tmp",ios::out);  // open file for                                                 // writing
OUTFILE << edit1;
OUTFILE.close();

By the way, what is edit1;
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1181345
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
 
LVL 3

Expert Comment

by:q2guo
ID: 1181346
#include <fstream.h>

What compiler are you using?
Are you programming in windows or dos?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:stevenc317
ID: 1181347
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
 
LVL 3

Expert Comment

by:q2guo
ID: 1181348
hex??  What are you trying to save?  What is 'edit1' in you
questioN?
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1181349
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
 
LVL 3

Expert Comment

by:q2guo
ID: 1181350
Are you using visual C++?
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1181351
I am using Borland C++ Builder v1.0 for Win95
0
 
LVL 3

Expert Comment

by:q2guo
ID: 1181352
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
 
LVL 1

Author Comment

by:stevenc317
ID: 1181353
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
 
LVL 3

Expert Comment

by:q2guo
ID: 1181354
I was just giving you an example.  getContent() is not
a member function.  You should look up help for the actual
function.
0
 
LVL 1

Author Comment

by:stevenc317
ID: 1181355
thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

808 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