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

Post Reply
AronE.
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 31
Joined: Mon Sep 14, 2015 8:04 am

Text Editor(and my other topic)

Post by AronE. »

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=aa2330d75 ... a66#p91258
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 79
Joined: Sun Oct 02, 2011 3:28 pm
Current Project: Top secret (not really) Top-Down Shooter for GBA
Favorite Gaming Platforms: GBA, Gamecube, PC, 3DS
Programming Language of Choice: C/C++
Contact:

Re: Text Editor(and my other topic)

Post by YourNerdyJoe »

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
See that?.....
Exactly
https://yournerdyjoe.github.io/
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Text Editor(and my other topic)

Post by dandymcgee »

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:
AronE.
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 31
Joined: Mon Sep 14, 2015 8:04 am

Re: Text Editor(and my other topic)

Post by AronE. »

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...
User avatar
YourNerdyJoe
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 79
Joined: Sun Oct 02, 2011 3:28 pm
Current Project: Top secret (not really) Top-Down Shooter for GBA
Favorite Gaming Platforms: GBA, Gamecube, PC, 3DS
Programming Language of Choice: C/C++
Contact:

Re: Text Editor(and my other topic)

Post by YourNerdyJoe »

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.
See that?.....
Exactly
https://yournerdyjoe.github.io/
Post Reply