Text Editor(and my other topic)

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Text Editor(and my other topic)

Postby AronE. on Sun Nov 08, 2015 2:13 pm

So, I started making a text editor, but there was my first, stupid problem - how to save the text?
You know, when you enter Notepad++ (for example) you write something, save the file and close it, when you open it again the text is there - it's saved.
I wanted to make the same thing, but didn't know how... 3 Days later I still have no idea xDDD

So, I made a String, but couldn't connect it to the TextArea and then make it save itself everytime I press the "Save" button. If you wanted to make an editor, how would you solve this problem? (Yes, it's a problem for me.. lol). I just want to connect both things and make the stupid button work...
I tried with the concat method, I tried other methods but none of them worked...


P.S.:
Also, would someone check this topic : viewtopic.php?f=4&p=91258&sid=aa2330d75a529e104f11172dcc326a66#p91258
AronE.
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 31
Joined: Mon Sep 14, 2015 9:04 am

Re: Text Editor(and my other topic)

Postby YourNerdyJoe on Sun Nov 08, 2015 8:18 pm

I don't know which language/api you're using but you should be doing something like this:
When save is clicked
open file for writing
get text from the text area
write the string to the file
close the file
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
 
Posts: 83
Joined: Sun Oct 02, 2011 4:28 pm

Re: Text Editor(and my other topic)

Postby dandymcgee on Sun Nov 08, 2015 11:31 pm

AronE. wrote:You know, when you enter Notepad++ (for example) you write something, save the file and close it, when you open it again the text is there - it's saved.

Somewhere Notepad++ saves a list of files you had open last time and reopens them upon loading. If you use e.g. ProcessExplorer you can get a list of open file handles and see where it's being saved to. My guess is C:\Users\<username>\AppData\Local\Notepad++\settings.ini or something like that.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
 
Posts: 4911
Joined: Tue Apr 29, 2008 4:24 pm
Location: New Hampshire

Re: Text Editor(and my other topic)

Postby AronE. on Mon Nov 09, 2015 7:42 am

YourNerdyJoe wrote:I don't know which language/api you're using but you should be doing something like this:
When save is clicked
open file for writing
get text from the text area
write the string to the file
close the file


Yes, but how exactly to save it after the first time it's being closed? I don't want to save it as a notepad file...

I want to make it like this :
I open my program.
Write text.
Press Save.
Close it.
Open the program again - the text is there.

I'm using Java btw...
AronE.
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 31
Joined: Mon Sep 14, 2015 9:04 am

Re: Text Editor(and my other topic)

Postby YourNerdyJoe on Mon Nov 09, 2015 9:38 pm

Have it write what files are open when it closes to another file. Then load that file when the program loads so it knows to open the last file you were editing automatically.
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
 
Posts: 83
Joined: Sun Oct 02, 2011 4:28 pm


Return to Programming Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron