Hello all

I wanted to make a text editor in C or C++. I wanted to make it for learning purpose only and also so that I can modify it further according to my personal use. I am good at C++ but do not have much experience at writing large codes(more than 500k lines) in C or C++. So I just thought why not to make my own txt editor.
I wanted help on how to start making one and what to study and from where ?
Any other suggestion regarding alternative ideas or platform are welcome.

I'm assuming you're doing this for Windows? Have you had any experience with any of the GUI toolkits? I could rattle them off but there's probably a list on the site somewhere. Ok some examples anyway: MFC, .NET/Winforms (C++/CLI), Win32 API, third party ones like wxWidgets, Qt, you name it. Doing it in C limits those options down quite a bit but it's still probably doable.

I know you probably want to build you own but there's supposedly a MSDN sample project for VC++ 2008 included in this package.

I'm assuming you're doing this for Windows? Have you had any experience with any of the GUI toolkits? I could rattle them off but there's probably a list on the site somewhere. Ok some examples anyway: MFC, .NET/Winforms (C++/CLI), Win32 API, third party ones like wxWidgets, Qt, you name it. Doing it in C limits those options down quite a bit but it's still probably doable.

I do not know any GUI toolkit for C.....just know Eclipse for Java
I wanted to do this project for learning purpose also, that's why I wanted to build it from the scratch. Even, any other program/project idea other than text editor would also do, I just want to learn and ready to invest my time and effort for it. But right now , I have text editor in my mind, I wanted to work on it from the very basic on it and build upon it.

just know Eclipse for Java

Did you do any designing with it in Java (I honestly don't know if does but suspect that among the 10^23 add-ons for it there must be some GUI building there somewhere)? If you just meant you used it as an IDE that's not really what I meant.

Well, do some random googling on the terms that I gave you before and see if anything sparks your interest. The third party libs are freely available (Qt has varying licenses depending on the end product) but you'll need a full version of Visual Studio to use MFC. Win32 and .NET stuff is available through the express edition.

Actually, I wanted to do work in C, C++ or Java only. I know VB 6.0, and know how to do all sort of things with it. But wanted to, as mentioned before, start from scratch, infact wanted to program everything myself

C, C++ or Java only

Are you talking about writing something like a console application? Otherwise neither standard C nor standard C++ has any kind of GUI functionality built in. I'm not sure about Java.

Are you talking about writing something like a console application? Otherwise neither standard C nor standard C++ has any kind of GUI functionality built in. I'm not sure about Java.

I am ready to learn anything, just anything.but I am desperate to start. If you can suggest some other language or project idea which would involve some real learning work and can help me learning in how to manage large programs , i shall be highly thankful. anything like an audio recording module or webserver in C(like apache)..
if you can guide me on these ?

A GUI is not necessary. Long before there was windows, there were editors.

The way to get started is-- Code nothing until you do the following:
Design how you --

  • accept the file name
  • display the file after reading it
  • move through the file when you can only read part of the file at a time
  • use the keyboard to move through the file

The very original editors did not use the screen. For example my favorite older editor, TECO, use the * prompt and input commands:
T- type a line from the cursor position to EOL
L - line move to another line
Ixxx - Insert 'xxx' at the cursor position

This would be a preliminary command list if designing a TECO-like editor.

Further definition would be the modifiers, such as numbers that tell 'how many':
If you cursor is in the middle of a line, 0T will display from the beginning of the line to the cursor. Display the whole line with 0TT
-5T5T - display 10 lines, 5 before, 5 after the cursor.
2L - move to the beginning of the 2nd line following your current position.
etc....

You need to know where you're going before coding. then program bits and pieces. Never program it all at once and try to compile.

I'm not suggesting writing a TECO-like editor, just giving you taste of what you need to think about.

@WaltP - I wasn't trying to imply some sort of disdain for the text-based system but instead was just trying to understand what the OP's intent was. What language were you doing when you used it?

@OP - There was a great thread a couple weeks back about next steps to take in C/C++. It's probably worth a read.

@WaltP - I wasn't trying to imply some sort of disdain for the text-based system but instead was just trying to understand what the OP's intent was. What language were you doing when you used it?

I didn't take anything as disdain. I simply mentioned the text based editors because it's one less thing to 'learn'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.