hey guys.. yaar i m very new in c++.. i need some help actually not some really big help:'( .. plz send me the code for a very simple text editor,, help me.. plz plz.. i expect the answers really thick and fast.. plz plz just a very simple text editor.. plz plz help me.. thanks alot looking forward.. thanks again:):

MosaicFuneral commented: Begging gets you nothing. +0
Salem commented: Try learning English first, or even how to use a keyboard -5

Recommended Answers

All 13 Replies

If you're so new, then why are you trying a text editor?
Why not learn the basics first, or just Google one.

I agree with mosaic.

int main(void){
  system("notepade.exe");
  return 0;
}

Chris

i would do that,, but i have an assignment to give,, u see the teacher is so strict and he gave us this program.. very simple text editor guys,, no need of font size, bold italics.. and acoloured background.. he said just a simple having an option to save and open and new

>but i have an assignment to give
Hense the I. You have to do it, not us.

commented: Exactly +8

ohh guys plz..it is of ten important marks.. i dont have any time now.. i have to submit it tomorrow plz help me out.. and i dont even know how to start.. plz make me a a program of the text editor.. i would be very thankful.

ohh guys plz..it is of ten important marks.. i dont have any time now.. i have to submit it tomorrow plz help me out.. and i dont even know how to start.. plz make me a a program of the text editor.. i would be very thankful.

We show no mercy :icon_twisted:

oh comon.. plz plz.. i would be very thank full. i m sure i will learn from it.. plz guys

commented: Dont pm for help. -1

Mod please close this thread.

ooh nice.. ok guys i made such a stupid text editor now plz help me put how can i improve it.. u know what i want is to when i press ctrf+f i get the file option.. then if i press s i get the file to save.. this is the best i could make..

So, I guess you dont plan on having this made using the windows API then, because of that, it wont be easy to allow shortcut keys like ctrl-f. Here is your code cleaned up a little with some unneeded code removed.

#include "iostream"
#include "fstream"
#include "string"

#define nula   0;

using namespace std;

char filename[_MAX_PATH];
char strings[100000001]="";

int main(int argc, char* argv[])
{
  system("CLS");
  system("color 8");

  cout << "\n//////////// WELCOME TO MUNEEB'S TEXT EDITOR \\\\\\\\\\\\\\\n\n";
  cout << "(PRESS ENTER WHEN YOU ARE DONE)\n\n\n\n";

  cin.getline(strings,100000001);

  system("color 16");

  cout << "\n\n\n------SAVE AS:-------\n";
  cout << "\nPLEASE WAIT.................................\n";   // Is this really necessary?
  cout << "ENTER THE FILNAME:";

  cin >> filename;

  ofstream go;
  go.open(filename);
  go << strings;

  system("CLS");
  cout << "TO END THIS PROGRAM\n";
  system("pause");
}

On line 10, you are making an array of characters with a size of 100000001, instead of using a ridiculously oversized array, simply use the standard std::string which will make everything a whole lot simpler. This is what the updated program should look like:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

char filename[_MAX_PATH];
[B]std::string text;[/B]

int main(int argc, char* argv[])
{
  system("CLS");
  system("color 8");

  cout << "\n//////////// WELCOME TO MUNEEB'S TEXT EDITOR \\\\\\\\\\\\\\\n\n";
  cout << "(PRESS ENTER WHEN YOU ARE DONE)\n\n\n\n";

  [B]getline( cin, text, '\n' );[/B]

  system("color 16");

  cout << "\n\n\n------SAVE AS:-------\n";
  cout << "\nPLEASE WAIT.................................\n";
  cout << "ENTER THE FILNAME:";

  cin >> filename;

  ofstream go;
  go.open(filename);
  [B]go << text;[/B]

  system("CLS");
  cout << "TO END THIS PROGRAM\n";
  system("pause");
}

As for the shortcut keys, for your level of programming, it's not worth going in to as it will just complicate things and most lightly confuse you.

Hope this helps.

thanks Alot.. still it would be better if u tell me how to use them.. because thats what he needs.. how do i save the text for real??

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.