Thread: Text editor

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    49

    Text editor

    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.

  2. #2
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    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.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    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.

  4. #4
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949
    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.
    Yeah, but console is faster and much more portable (depending on the code, of course ).
    Do not make direct eye contact with me.

  5. #5
    Board Conservative UnregdRegd's Avatar
    Join Date
    Jul 2003
    Posts
    154
    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.

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    49
    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.

    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;
    }
    Thanks.
    DJGPP-Complier
    Windows 98-(Shouldn't need to explain)

    I like plants.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 05:26 PM
  2. C++ For Text Editor?
    By bmroyer in forum C++ Programming
    Replies: 12
    Last Post: 04-05-2005, 02:17 AM
  3. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  4. help about text editor
    By nag in forum C++ Programming
    Replies: 2
    Last Post: 04-24-2003, 11:45 AM
  5. Making a text editor
    By neandrake in forum C++ Programming
    Replies: 5
    Last Post: 02-26-2002, 11:43 PM