I want to program a text editor to demonstrate use of fstream. Can you create a File Edit etc. menu using C++? And how do I allow users to open files and freely edit them?
I want to program a text editor to demonstrate use of fstream. Can you create a File Edit etc. menu using C++? And how do I allow users to open files and freely edit them?
DJGPP-Complier
Windows 98-(Shouldn't need to explain)
I like plants.
If you want to use a GUI, this is the wrong forum. Otherwise, just ask for the name, and open it up with a fstream.
Do not make direct eye contact with me.
what Lurker probably means is, is that menus etc can be written in C++, but it is done in the context of a graphical user interface, such as Windows, not in a console using standard C++. Therefore the Windows forum may be a better place to ask this question.
Users can get files and edit them using a console, it just isn't as pretty or "user friendly" as it is with a graphical user interface that allows menus, etc.
Yeah, but console is faster and much more portable (depending on the code, of course ).Originally posted by elad
Users can get files and edit them using a console, it just isn't as pretty or "user friendly" as it is with a graphical user interface that allows menus, etc.
Do not make direct eye contact with me.
A simple line-oriented text editor, like MS-DOS's EDLIN.COM, is the easiest and most portable type of text editor to code. Try that.
I am a programmer. My first duty is to God, then to nation, then to employer, then to family, then to friends, then to computer, and finally to myself. I code with dignity, honor, and integrity.
How do I program and use a console. Also, I'm having a problem with my current code. The strings aren't working properly, it's only writing one character to the file so it's only importing one character from the file.
Thanks.Code:#include <stdlib.h> #include <iostream.h> #include <fstream.h> int main() { char file[5000];//text to be submitted to file char file_a[5000]; cout<<"This is a text editor.\n"; cout<<"Begin typing and press enter when you want to save.\n\n"; cin>>file;//input to file cout<<"\n";//new line ofstream fileone("text.txt", ios::ate); fileone<<file; fileone.close(); ifstream filetwo("text.txt"); filetwo>>file_a; cout<<file_a; filetwo.close(); system("PAUSE"); return 0; }
DJGPP-Complier
Windows 98-(Shouldn't need to explain)
I like plants.