-2

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:):

Comments
Try learning English first, or even how to use a keyboard
Begging gets you nothing.
5
Contributors
13
Replies
14
Views
8 Years
Discussion Span
Last Post by death_oclock
Featured Replies
0

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

0

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.

0

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:

0

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

Attachments
#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "string"

#define nula   0;


using namespace std;

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



int _tmain(int argc, _TCHAR* argv[])
{
	system("CLS");

	system("color 8");
cout<<"\n//////////// WELCOME TO MUNEEB'S TEXT EDITOR \\\\\\\\\\\\\\"<<"\n";
cout<<endl;
cout<<"(PRESS ENTER WHEN YOU ARE DONE)"<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cin.getline(strings,100000001);
cout<<endl;	
cout<<endl;
cout<<"\n------SAVE AS:-------\n";
	system("color 16");
cout<<"\nPLEASE WAIT.................................\n";
cout<<"ENTER THE FILNAME:";
cin>>filename;
if(filename!=NULL)
{
ofstream go;
go.open(filename);
go<<strings;
}
system("CLS");
cout<<"TO END THIS PROGRAM "<<endl;
system("pause");

}
0

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.

0

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

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.