need help in creating simple line editor

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2004
Posts: 13
Reputation: potential is an unknown quantity at this point 
Solved Threads: 0
potential potential is offline Offline
Newbie Poster

need help in creating simple line editor

 
0
  #1
Sep 30th, 2004
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!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 40
Reputation: coolmel55 is an unknown quantity at this point 
Solved Threads: 1
coolmel55 coolmel55 is offline Offline
Light Poster

Re: need help in creating simple line editor

 
0
  #2
Sep 30th, 2004
what's the syntax to load a text file using a c++ program...
Try something like this!

  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
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,829
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 750
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: need help in creating simple line editor

 
0
  #3
Sep 30th, 2004
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.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 13
Reputation: potential is an unknown quantity at this point 
Solved Threads: 0
potential potential is offline Offline
Newbie Poster

Re: need help in creating simple line editor

 
0
  #4
Oct 8th, 2004
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!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,829
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 750
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: need help in creating simple line editor

 
0
  #5
Oct 8th, 2004
>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.
New members chased away this month: 3
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC