Sublime Forum

Something Happened to My File

#1

So, there I was, working on my program. I stopped working on it for a while but kept Sublime text opened. I went to play some games and stuff.

I’m not really sure when, but eventually I realized that Sublime Text had stopped responding. Pressing the X button wasn’t working, task manager wasn’t working, it was horrible. Eventually, when I wasn’t watching, it closed itself.Then more stuff happened like explorer.exe not responding. Because I had the command prompt still working, I entered “shutdown /r” or something. Maybe it was -r, I don’t remember. A little after, my computer started to restart. But then I realized that my computer takes forever to restart for some reason. So, after waiting about 5 minutes, I powered it off while it was restarting using the power button.

When I turned my computer back on, I opened sublime text. The first thing I noticed was that only 2 of the 5 or 6 files I had opened before were still opened. Those being main.c and main.h. Also, main.c was being viewed in some hex editor mode or something. (picture) That was weird, so I opened main.c in a different hex editor program. I’m not sure what the files normally looks like, but I’m pretty sure it’s messed up. (picture) main.c was the file I was working on before Sublime Text stopped responding last time. Also, going to the file properties says it was last modified yesterday, December 8, 2016, at 10:56:22 PM. Which can’t be true.

And, finally, a link to main.c:
https://drive.google.com/open?id=0B_dtrDoDosSJWHdfazc1MXUxLXc


So, my questions are:

  • What happened to my file?
  • Why did that happen?
  • Can I recover it? ( I didn’t make backups because I’m stupid )
  • What can I do to prevent this in the future? (Most important question)
0 Likes

#2

What is your Sublime Text version?

What is your OS version?

Does it happens to everything you open with Sublime Text?


What happened to my file?

It is opening as a binary file. Sublime Text does it for files which contain certain characters present on binary files.

Why did that happen?

Did that happened because you seems you use windows and windows is a very hard to use platform to keep stable. Probably the game, virus or some other application messed up within the entire windows system corrupting stuff.

Can I recover it?

Open your file with some other editor, and remove the characters which it should not have.

What can I do to prevent this in the future?

Do not use windows, or find out which application/virus (may be a windows update) messed up within you entire system and remove it. Also if you use windows, install the latest version and updates (about updates, maybe take it slow).

I use windows and I also use linux. Both are good platforms but you need to know what you are doing on each one of them. You can disturb you Windows as your Linux if you do not know what you are doing, and it is easy thing to do.

If you are tired and everything is too buggy and you do not have more patience for this, just install linux or buy a Mac OS. But you will also find problems, but may be you like to solve them more than the windows problems. On my case I just do not care about which platform I am and I just to solve them. Unless for now. If windows start crashing itself, its application start being obsolete, etc, it is a good bye. But for now it is not the case, the OS is not crashing and its applications I use seems not to be obsolete.

1 Like

#3

If it’s being treated as binary by Sublime, it’s possibly because of nul bytes in them:

// Files containing null bytes are opened as hexadecimal by default
"enable_hexadecimal_encoding": true,

I’ve never tried turning the option off so I don’t know what happens in that case if you open a binary file (I assume it’s just opened as normal) but even so, choosing File > Reopen with encoding might allow you to recover the text in sublime.

1 Like

#4

I’m using Sublime Text 3, on the stable channel, build 3126.
I’m using Windows 8.1.
This has only happened once, and I’ve been using Sublime Text for over a year now.

I’ll take switching over to Linux into consideration so this doesn’t happen again, thanks!
I think I’d be too hard to narrow down a problem like this, considering it’s only happened once and I don’t know why.

0 Likes

#5

Thanks for trying to help, but I think that file is gone forever. There’s null characters everywhere and the only text that’s actually there is a bunch of jumbled up words and a few of my variable names.

0 Likes