Ok so I need to create a program in ncuses that acts like a text editor. So far I have it fully functional to where it reads the file and prints it on the screen and the user can use the arrow keys to move the cursor to add or remove characters. When I opened the file I used the following code:
Code
FILE *fp;
char *fileArray = new char[fileSize];
fp = fopen(fileName, "r+");
The problem that I'm running into is when I try to write the changes the user made back to the file itself. I'm looking for something that could read the ncurses window and return the character but I've tried this:
Code
ofstream file("new.txt");
move(0,0);
for(int b=0; b<row; b++){
for(int q=0; q<col; q++){
chtype ret = mvinch(b,q);
file << ret;
}
}
But the new file is just a bunch of random number so I'm not sure what to do here. A little guidence would be great. Thanks
This post was edited by ice060788 on Oct 7 2016 10:48pm