-
Sep 22nd, 2021, 07:06 PM
#1
Thread Starter
Junior Member
When opening a file in Notepad
welcome..
I know that Notepad is not intended for displaying data and source code, but rather it is for displaying texts only, but something crossed my mind
When we open a file or image in Notepad, the following codes appear.
Do these codes have a name?
How does a computer process these codes and things?
And if we say that there is a file of 2 megabytes
How can I check the data and source code for this 2MB?
-
Sep 22nd, 2021, 08:22 PM
#2
Re: When opening a file in Notepad
All files are stored in binary form. Whenever you open a file, that binary data has to be interpreted in some way. For a text file, the bytes in the file are converted to characters using some encoding, e.g. ASCII or some form of Unicode. If you open an image file or something else then the bytes don't represent text but a text editor like Notepad will interpret them that way, because that is all it knows. That is why you get gibberish: It's like if a bird was pecking on a tree trunk and you tried to interpret it using Morse code. You would get gibberish because the input wasn't intelligible text in the first place.
How the computer processes the content of a file to make sense of it depends on the file type. Applications and the OS itself will generally take a hint as to what's in the file from the extension, but sometime they will also read a header in the file and if it conforms to a particular format then they will assume that the rest of the file is in that format.
As for the question about file size, I'm not sure exactly what you're looking for. You've posted in a VB.NET forum so I assume that you want a VB.NET answer. You can create a FileInfo object for the specified file and get its Length property, which will be the number of bytes the file contains. Windows uses 1024 as a multiplier for file sizes, not 1000, so you would divide that number of bytes by 1024*1024 to get the number of megabytes. If you actually want to count the bytes yourself then you can call File.ReadAllBytes to get the file contents into a Byte array and then get the Length of that. What is it that you're actually trying to achieve?
-
Sep 23rd, 2021, 10:55 AM
#3
Re: When opening a file in Notepad
Originally Posted by jmcilhinney
For a text file, the bytes in the file are converted to characters using some encoding, e.g. ASCII or some form of Unicode.
In this particular case it's trying to interpret the bytes as ANSI text(it's in the lower left of both images) which is whatever the current codepage on that machine is will be used to determine what characters the bytes represent.
-
Sep 23rd, 2021, 12:05 PM
#4
Thread Starter
Junior Member
Re: When opening a file in Notepad
Thank you for the answer
I want to get the binary code of a file or image via vb.net
-
Sep 23rd, 2021, 12:10 PM
#5
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
Thank you for the answer
I want to get the binary code of a file or image via vb.net
This:-
Originally Posted by jmcilhinney
you can call File.ReadAllBytes to get the file contents into a Byte array
-
Sep 23rd, 2021, 01:28 PM
#6
Thread Starter
Junior Member
Re: When opening a file in Notepad
In short, I want a way through which I can copy a code or code for an image
Then I transfer this code to another computer to open
I want to make a project in Visual Basic through which I extract a code for a specific file (DeCompiler).
And this code is sent to the other computer and the code is analyzed and a Compiler is made for it.
-
Sep 23rd, 2021, 02:01 PM
#7
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
In short, I want a way through which I can copy a code or code for an image
Then I transfer this code to another computer to open
I want to make a project in Visual Basic through which I extract a code for a specific file (DeCompiler).
And this code is sent to the other computer and the code is analyzed and a Compiler is made for it.
Are you looking at a way of transferring files between two computers? I am not entirely sure what you mean by extracting code for a specific file (DeCompiler) and then compiling it again.
-
Sep 23rd, 2021, 02:35 PM
#8
Thread Starter
Junior Member
Re: When opening a file in Notepad
Originally Posted by PlausiblyDamp
Are you looking at a way of transferring files between two computers? I am not entirely sure what you mean by extracting code for a specific file (DeCompiler) and then compiling it again.
No
I want to extract the binary code of a file for a specific purpose (transfer this binary code to another computer (specifically in this way for a specific purpose))
After the transfer, this binary system is converted to the original file
-
Sep 23rd, 2021, 02:41 PM
#9
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
No
I want to extract the binary code of a file for a specific purpose (transfer this binary code to another computer (specifically in this way for a specific purpose))
After the transfer, this binary system is converted to the original file
Not really sure what you mean by "extract the binary code of a file", a file is nothing more than a collection of bytes. You can just read the bytes as Niya describes above.
-
Sep 23rd, 2021, 02:46 PM
#10
Thread Starter
Junior Member
Re: When opening a file in Notepad
Originally Posted by PlausiblyDamp
Not really sure what you mean by "extract the binary code of a file", a file is nothing more than a collection of bytes. You can just read the bytes as Niya describes above.
Can you give me a project example of how to extract the bytes of an image, for example?
-
Sep 23rd, 2021, 06:12 PM
#11
Re: When opening a file in Notepad
I'm thinking Dodi's Decompiler...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Sep 23rd, 2021, 07:08 PM
#12
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
Can you give me a project example of how to extract the bytes of an image, for example?
Why would we need to give you a project example? We've told you what to do. Just do it. It's not for us to write your code for you.
-
Sep 23rd, 2021, 07:39 PM
#13
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
Can you give me a project example of how to extract the bytes of an image, for example?
What do you mean by "image"? Do you mean like an actual picture file like a JPG, BMP ect or do you mean "image" in a more general sense like a "binary image" which can mean like an EXE image? You need to be clear.
-
Sep 24th, 2021, 03:05 AM
#14
Thread Starter
Junior Member
Re: When opening a file in Notepad
Originally Posted by jmcilhinney
Why would we need to give you a project example? We've told you what to do. Just do it. It's not for us to write your code for you.
I really did not understand and need more details about extracting the files data..
-
Sep 24th, 2021, 03:10 AM
#15
Thread Starter
Junior Member
Re: When opening a file in Notepad
Originally Posted by Niya
What do you mean by "image"? Do you mean like an actual picture file like a JPG, BMP ect or do you mean "image" in a more general sense like a "binary image" which can mean like an EXE image? You need to be clear.
Let me explain you immediately .. now when I send a file (a song or his image or any file) to someone online, the data of my file will be upload to the Internet to the ... I want to get this data I can copy it and save it and when i need to run that applcation do compiler to the data
-
Sep 24th, 2021, 03:28 AM
#16
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
I really did not understand and need more details about extracting the files data..
You've been told to call File.ReadAllBytes. Do it. If you don't understand how then find out on the internet. You don't need us to provide every detail when there's so much information out there already. Did you bother to read the documentation for that method? Did you search the wen for existing examples? Of course you didn't. You just sat on your hands and waited for others to make the effort that you won't.
-
Sep 24th, 2021, 03:48 AM
#17
Thread Starter
Junior Member
Re: When opening a file in Notepad
Originally Posted by jmcilhinney
You've been told to call File.ReadAllBytes. Do it. If you don't understand how then find out on the internet. You don't need us to provide every detail when there's so much information out there already. Did you bother to read the documentation for that method? Did you search the wen for existing examples? Of course you didn't. You just sat on your hands and waited for others to make the effort that you won't.
You're totally wrong!!! I didn't come to this forum until after I lost hope.
And I have already said that this method (File.ReadAllBytes) does not work,
Say good And give me the tip of the thread Or you can just ignore me.
-
Sep 24th, 2021, 03:50 AM
#18
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
Let me explain you immediately .. now when I send a file (a song or his image or any file) to someone online, the data of my file will be upload to the Internet to the ... I want to get this data I can copy it and save it and when i need to run that applcation do compiler to the data
I don't understand. You want to download a file someone sent? You want to upload? What does copying have to do with this? I know you know what you mean but you must understand, your English is very hard to parse. Whatever you are using to translate to English is not being clear enough. When talking about writing a program, details matter so much more than they would in a typical everyday conversation.
-
Sep 24th, 2021, 04:14 AM
#19
Re: When opening a file in Notepad
Originally Posted by Basil Abdallah
I have already said that this method (File.ReadAllBytes) does not work
Except it does work to get the data contained in a file. If it doesn't do what you want then what you want is not to get the content of a file. If you can't explain what you actually want, there's not much chance of our helping you achieve it. We're almost at 20 posts in this thread and either no one knows what you're talking about or you already have your solution but won't use it. Neither reflects well.
-
Sep 24th, 2021, 05:16 AM
#20
Re: When opening a file in Notepad
I think he wants some like sending a file to another computer.
Like WhatsApp in which you select a picture file and the image is transmitted to the receiver and shown on the screen
ReadAllBytes get the data from his local computer, but it needs to be send to some other computer and either be stored or/and displayed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|