943,972 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4703
  • C++ RSS
Sep 30th, 2004
0

need help in creating simple line editor

Expand Post »
hi! i'm trying to make a simple line editor...

i have two main questions in mind:
1.) what's the syntax to make the cursor appear at the middle, or at the bottom part of the screen...or how can you print something and make it appear at a certain position

2.) what's the syntax to load a text file using a c++ program...

please help...we haven't discussed it in class... :cry:

thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
potential is offline Offline
13 posts
since Sep 2004
Sep 30th, 2004
0

Re: need help in creating simple line editor

Quote ...
what's the syntax to load a text file using a c++ program...
Try something like this!

C++ Syntax (Toggle Plain Text)
  1.  
  2. #include <fstream> //include this standard template library
  3.  
  4. char filename[16]; //declare a variable string this one is 16 characters long
  5. string line; //decalare a string variable
  6.  
  7. cout << "Enter the name of the program that you would like data for: ";
  8. cin >> filename;
  9.  
  10. ifstream instream(filename);
  11.  
  12. if(instream.fail()) //This will check to see if the file open fails for whatever reason
  13. {
  14. cout << "Input file opening failed.\n";
  15. exit(1);
  16. }
  17.  
  18. while ( getline(instream, line) ) //this will read the file in line by line
Reputation Points: 10
Solved Threads: 1
Light Poster
coolmel55 is offline Offline
40 posts
since Sep 2004
Sep 30th, 2004
0

Re: need help in creating simple line editor

1) Platform and implementation dependent. What compiler and OS are you using?

2) This is in any book on C++.

>please help...we haven't discussed it in class...
You'll be in big trouble if you wait until everything is discussed in class before you do your own research.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 8th, 2004
0

Re: need help in creating simple line editor

i actually figured out the opening file part, but i'm still modifying the code.

but i can't find a useful book on how to make the cursor go to a certain part of the screen or something...all the good books are on loan...
i'm using bloodshed's dev-c++

thanks a lot!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
potential is offline Offline
13 posts
since Sep 2004
Oct 8th, 2004
0

Re: need help in creating simple line editor

>i can't find a useful book on how to make the cursor go to a certain part of the screen or something
What part of "platform and implementation dependent" is difficult? If you're looking for a book that tells you how to do this, it's going to be very specialized and thus very difficult to find. I have six letters for you, G.O.O.G.L.E. A braindead search will still give you something to work with.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Why doesn't my code work??
Next Thread in C++ Forum Timeline: Borland C++ builder - how to save in .CPP format





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC