Making something: Saving a text file as an .exe?

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Making something: Saving a text file as an .exe?

Post by Mentat »

I made a little text file in notepad that just showed a 4*4 * 4*4 matrix multiplication. Bored and rather curious, I resaved the file as an .EXE . So I ran it (yes, it did run), though it did nothing.

My question is can I make the new executable do anything (besides blink a cursor) just by using notepad? I guess other files can be saved as .exes (Visual Paint# : The Paint program that makes executables! Get your copy today!). Is there some kind of hidden language that resides within?
For any grievances posted above, I blame whoever is in charge . . .
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Renaming a file does not make it that type of file. Many files require information headers that are not in a text file. You could make the text file into a BAS file and run it. Later you could compile it.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

Well, something happens. I opened an executable in notepad, saved it as .txt, then resaved it as an .exe . Then it did the same thing as the unaltered version. Which was to print "Hello world", though I forgot to add "sleep".

And I guess these headers aren't the same as MS Word headers?
For any grievances posted above, I blame whoever is in charge . . .
User avatar
Codemss
Veteran
Posts: 124
Joined: Sun Jun 24, 2007 6:49 am
Location: Utrecht, The Netherlands
Contact:

Post by Codemss »

Have you read burger's post: Renaming a file as a .EXE is not right: you need to compile it. Basically you can give any file any extension: it is just to let windows know what program to open it with. A .EXE and a .TXT file can both hold the same data.
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

LOL

Post by burger2227 »

Well, all you really did was save an EXE as TXT and convert it back. No wonder it worked!

If it was that easy to do why would you even need a compiler in QB? Try making a BAS file into a TXT file and renaming it EXE. The compiler changes your code to machine language. Notepad does not!

You may have noticed that the stuff in the text file was mostly unreadable. Notepad also usually converts to ANSI characters.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

It must be the y's. They're everywhere!
For any grievances posted above, I blame whoever is in charge . . .
Post Reply