C# :: Add Line Numbers To A Text Editor
Jun 7, 2012
I'm trying to add line numbers to a text editor I'm building but not having much luck. I'm trying to find a way around building something massive with a picture box next to my textbox etc. I'm tried adding VS Basic to my references and searching for the linenum_rtf.cs but I can't seem to find it under existing items.
View 4 Replies
ADVERTISEMENT
Mar 26, 2013
They should apply for: backspace, return, regular char input, vertical scrolling. There is only one buffer, and it is not allowed to side scroll past max col, instead it must scroll down, appending the line cur_y + 1.
View 4 Replies
View Related
Nov 21, 2013
I want to add plugins like line numbering, syntax highlighting,code coloring,text alignment in a text editor. How i start including them?
View 1 Replies
View Related
Oct 24, 2013
when making a text editor do you have to create a parser for it or are parsers just used in compilers and interpreters?
View 6 Replies
View Related
Mar 27, 2013
I am working on a project for school that has us read in a text file that contains 8 lines of SSN and grades. I am not sure how to go about reading in the lines and differentiate between the SSN and grades in the calculations.
View 1 Replies
View Related
Jan 3, 2013
I'm building a find and replace function for my text editor I'm building the function without support from the algorithm header.
The function is written like: doc.find_replace("Word_to_be_replaced", "The_word_that_is_replacing"); I find this very easy to understand replace this, with this.
find_replace will both have char * as their arguments.
The problem I'm having right now if I replace a bigger word for a smaller word how do I delete the extra characters from memory.
So if I replace "Goodbye" with "Hello" how do I delete the last two characters? So I don't print garbage code.
View 1 Replies
View Related
Mar 10, 2015
I am trying to make a text editor in C++ that uses Linked Lists as the main driving force. I need to make a program that can add a line of text at a certain point, delete a certain line of text, print the entire text, and quit and save the text to the original text file inputted from the shell script. My problems are with the cpp file, and the linked list files. My remove function is not what I need it to be I know that. I also know that there are some problems with my cpp file myEditor. My code is below.
#include <sstream>
#include "linkylist.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[]) {
//node* head = new node;
[Code] ....
View 6 Replies
View Related
Sep 23, 2014
I'm supposed to make a basic text editor using a doubly linked list, I have pretty much written most of it but keep coming across several problems. In certain places,all marked in the code, I get the error "expected a declaration" ive looked online and nothing ive found works. And secondly I also get the error" declaration has no storage class or type specifier" but i havent been able to find anything that works either.
Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <assert.h>
#include <string>
[Code] ....
View 6 Replies
View Related
Jul 5, 2013
I have a text file (test.txt) with the following data:
01,05,25,20130728
01,06,25,20130728
01,07,25,20130728
01,08,25,20130728
01,05,25,20130728
01,05,25,20130728
01,05,45,20130728
01,05,65,20130728
01,05,85,20130728
01,05,35,20130728
01,05,25,20130728
01,05,35,20130728
I want to read this to one string called line. So far I have this code:
string line;
ifstream myfile ("/home/Test.txt");
if (myfile.is_open()) {
while (myfile.good()) {
getline (myfile, line);
for (int a = 0; a <= 335; a++) {
cout <<line.at(a);
} }
myfile.close();
}
so far its only printing the first line and then throwing an instance of 'std::out_of_range'
View 2 Replies
View Related
Aug 24, 2013
I can able to get the last line ten chars but i cant get if the last line is null.
here is my code
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
[Code] ....
here with i have enclosed my file where i am pick my last ten chars ...
Attached Files : log.txt (4.8 KB)
View 1 Replies
View Related
Jun 7, 2013
How can i delete a line from a file created using a C++ program?Can i get a code sample.
View 1 Replies
View Related
Jan 29, 2015
The program i wrote can run but did not work. I want to delete a line from the textfile "StaffList.txt" but when i cin the name, for example "Ben". After the program ran finished and i open the textfile, the name "Ben" and the whole line is still inside the textfile! I have created the "temp.txt" file before i run the program.
//information inside the "StaffList.txt"
James S1325685J12580
Peter S8856325K52650
Ben S1025639Z85250
Ken S9052365B74100
Marry S9352654I75320
John S7754852H99630
Jenny S7042525L74530
May S1256985G15960
Betty S1135565K56360
Kyle S9545530A1234100
[code]....
View 2 Replies
View Related
Feb 9, 2014
I need to store the last 3 deposit that I have in my deposit. I have few option but i dont which would be easy
1.Store all deposit to the text file (store always in a new line), and display the last three deposit from the text file.
dep 1 - 60
dep 2 - 40
dep 3 - 100 print 100
dep 4 - 50 print 50
dep 5 - 50 print 50
2. I think this option is more difficult, when it reach deposit 4, to get rid deposit 1
So when i make a deposit 4, the deposit 1 get's ride
dep 2 - 50
dep 3 - 100
dep 4 - 70
Right now i can only display one deposit (last one), then i close the program and run again and i make another deposit it overwrites a new deposit.
My code.
To show sure my deposit that has been made.
double depSave () {
int option;
float dep1,dep2,dep3;// Declare your variables
dep1 = dep2 = dep3 = 0; // Set them all to 0
system ("cls");
string path = "deposit.txt"; // Storing your filename in a string
[Code] ....
Where is says "save deposit" in comment that where it saves to the deposit text file, that going to be output to the depSave function.
View 2 Replies
View Related
Nov 10, 2014
This is about reading a "txt file" and storing the contents in a variable. But i've got problems with it because normally, it is space delimited, that is, values separated by spaces are considered different values. How am I going to make C++ read the whole line including spaces?
View 14 Replies
View Related
May 29, 2014
I am working on a bonus question for school. By using #include <iostream> and #include <string>, I need the user to input a sentence getline(cin,sentence). Move the first word of that sentence to the end.
example:
Enter a line of text.
MAC101 is the class
rephrased that line to read:
is the class MAC101
View 12 Replies
View Related
Aug 16, 2013
I am making a script to read the latest from a text file. It picks up the line by numbytes in fseek, but the data line may vary and numbytes not be accurate, how can I fix this?
And another problem is that the line has, date, time, value, separated by space, how to read that line and put these 3 information in variable?
#include <stdio.h>
#include <conio.h>
int main() {
FILE *arq;
char Line[100];
char *result;
int tam, i;
// Opens a file for READING TEXT
arq = fopen("temp.txt", "rt");
[code].....
View 19 Replies
View Related
Nov 3, 2013
I'm working on a program that prints every even number from 100 to 200. How i would be able to print 10 numbers per line?
Code:
#include <iostream>
using namespace std;
int main()
{
int x;
for (x=100; x<=200; x++)
cout <<x++<< endl;
system("pause");
return 0;
}
View 2 Replies
View Related
Jun 3, 2013
It's really simple to say to a pointer to point to a sigle character or a single number.
Code: int *ptr;
int a = 5;
cout << *ptr << endl;
But I want for example a pointer to change a whole text line. My idea is that the user enters which language he speaks.
Code: cout << "English" << endl;
cout << "Swedish" << endl;
But I don't know how to this. I could have done this without pointers with if statments but I want to do it with pointers because it were a exercise to do.
View 3 Replies
View Related
Dec 16, 2014
I'm trying to make a simple phonebook app that can show contacts, add, and delete. I'm pretty new to C++ and fstream functions, deleting a line in my bool erase() function?
#include <iostream>
#include <conio.h>
#include <string>
[Code].....
View 6 Replies
View Related
Dec 24, 2013
I have a text file like this
0 1 2 C
10 1 2 S
7 1 2 C
11 1 2 S
9 3 43 C
10 3 43 S
1 3 43 C
101 3 43 S
with this code
ifstream in("fout2.txt");
if (in) {
vector<string> lines;
string line;
while (getline(in, line))
[Code] ....
I obtain this result
0 1 2 C
1 3 43 C
10 1 2 S
10 3 43 S
11 1 2 S
101 3 43 S
7 1 2 C
9 3 43 C
but i want a result like this :
0 1 2 C
1 3 43 C
7 1 2 C
9 3 43 C
10 1 2 S
10 3 43 S
11 1 2 S
101 3 43 S
View 3 Replies
View Related
Feb 23, 2014
I have attached the file that I need to read into a data structure. In the example I am just printing it to the screen. This following code has worked for me before, but now isn't. I have tried in visual studios, and on unix, and neither are running it. I ultimately need it to run on unix.
Example file:
word
book
programming
Here is my function to read in the file.
ifstream file;
string line;
file.open("words.txt");
if(file.is_open()){
while(!file.eof()){
getline(file, line);
cout << line <<endl;
}
}
file.close();
View 7 Replies
View Related
Apr 23, 2014
I am writing a program for AES Encryption which is all but done as far as that the program encrypts the text and prints the encrypted text in the command prompt:
void main() {
int a;
unsigned char CipherKey[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
unsigned char PlainText[16] = {0x32, 0x43, 0xF6, 0xA8, 0x88, 0x5A, 0x30, 0x8D, 0x31, 0x31, 0x98, 0xA2, 0xE0, 0x37, 0x07, 0x34};
for(a=0;a<16;a++)
[Code] ....
Encrypted text output on command prompt = 39 25 84 1d 02 dc 09 fb dc 11 85 97 19 6a 0b 32
However, my project asks to "read blocks of data from a data file". Therefore I need to alter the main function to read the following arrays from a data file.
Unsigned char CipherKey[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};
unsigned char PlainText[16] = {0x32, 0x43, 0xF6, 0xA8, 0x88, 0x5A, 0x30, 0x8D, 0x31, 0x31, 0x98, 0xA2, 0xE0, 0x37, 0x07, 0x34};
Firstly, I don't know how to take each individual part in the data file to store into each byte in the array i.e. 0x2B into CipherKey[0] of the array.
Secondly, How do I deal with the fact that each byte is in hexidecimal? How should my data file look?
this is what my data file Input.dat looks like at the minute:
0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
0x32, 0x43, 0xF6, 0xA8, 0x88, 0x5A, 0x30, 0x8D, 0x31, 0x31, 0x98, 0xA2, 0xE0, 0x37, 0x07, 0x34
The first line being the CipherKey array and the second being PlainText. I'm not sure if the '0x' or the commas are required.
I basically want to take the data from a file, store them in arrays in the program itself, encrypt the Input array PlainText and create a new file with the encrypted output array stored in it (I will deal with this part of the program after I get the input file done first).
View 6 Replies
View Related
May 13, 2014
I try to change the text color of console in C++. I know some commands like .
system("color fg");
But I want to change the color of only one line of console. Is this possible?
View 4 Replies
View Related
Feb 9, 2012
Why this code outputs 7 lines (the last line twice) while the file contains 6 lines?
cout << "read msgfile
";
ifstream msgfile ("script1.msg");
while (msgfile.good()) //if not at end of file, continue reading {
// load vector with deffile
msgfile >> line;
vectormsgfile.push_back (line);
cout << line << "
";
}
msgfile.close();
View 2 Replies
View Related
May 23, 2013
I'm reading from stdin a line. With that line, I should open a new textfile with the first letter of that line on a certain directory. My code is the following :
Code:
int main() {
char line[BUFSIZ];
FILE *ptr_file;
int x;
while(fgets(line,BUFSIZ,stdin) != NULL){
[Code] ....
char caminho[] is the directory in which I want to create the text file and chave will be the first letter of the line in stdin.
How am I supposed to use strcat to get these two together in a string to then use ptr_file =fopen(caminho, "w");
View 3 Replies
View Related
Jun 6, 2013
I build this function in my C++ code. I run the on a UNIX box, build HTML file to use in Windows.
In HTML file building code, I have only a string variable hold the contents of this text file (from unix) & add it into HTML file.
The issue is that when I view the HTML file on windows, it shows all the lines in the text file as one line. I think it lost the CRLF.
My question is when I add lines from text file (reading one line at a time) in UNIX, how do I maintain CRLF ( ) in the stringstream variable so that it will display on HTML in Windows properly, all the lines as it is in unix.
I am aware UNIX uses for line end.
string TextFileToString(string filename) {
string line;
stringstream dosString;
ifstream inFile;
[Code] ......
View 4 Replies
View Related