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!

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

Try something like this!

#include <fstream>  //include this standard template library

char filename[16];  //declare a variable string this one is 16 characters long
string line;  //decalare a string variable

cout << "Enter the name of the program that you would like data for: ";
cin >> filename;

ifstream instream(filename);

if(instream.fail()) //This will check to see if  the file open fails for whatever reason
{
            cout << "Input file opening failed.\n";
	exit(1);
} 

while ( getline(instream, line) )  //this will read the file in line by line

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.

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! :D

>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.

This article has been dead for over six months. Start a new discussion instead.