hello everyone..
please answer me , if you can give me working code
I thought about something...
I know that everything in our machines have addresses..
I thought about watching everything in my computer's random access memory(RAM)
But I don't want to see the information in view of garbage , I mean there are hundreds of thousands of processes, bits there(I want to make them char if it is possible and see texts)...
In addition I have to say that I want to see everything (no matter what it is) in char type
Somethings came to my RAM (mind)
So I wrote a simple code(C++) I got a pointer of variable of int *p
and in loop I wrote
//don't forget(int i = 0)//

while(true){
     std::cout << x[i++]<< '\n';
     sleep(1);//declared in <unistd.h>
}

I thought about bool and int
that bool takes only one bit -> but how am I going to make char from one bit
that int takes 4 bits -> I think there are a lot of problems
I wrote something like this and it showed me 0 or big numgers like 3879278398 or -436346346
I thought of using chars and strings, even I tried <sstream> to make that numbers text..
but even if that numbers are texts ... they are still numbers (not word or something like that)
That is interesting if I write "if" and tell if to take only ASCII coded numbers 256<n<0
what would happen .. I have idea, but I don't know how to make real it.


thank you very much

>>that bool takes only one bit -> but how am I going to make char from one bit
No, the bool data type takes a whole byte (or possibly int) because a byte is the smallest addressable object. If you are unsure about the size of something you can easily find out like this: cout << "sizeof(true) = " << sizeof(true) << '\n'; Are you asking how you can read all the RAM you have in memory? I know it can be done because antivirus scanners do it. Don't ask me how because I don't know.

As for converting numbers into something readable, I don't think that would be possible. All the bytes of RAM contain a numeric value between 0 and 255. How to interpret that data will be up to the program that wrote in those memory spots. External programs will have no clue about what the data means.

oh, I really forgot...
1 byte has 8 bits and in the 8 bits we can store numbers from 0 to 256(ASCII)
(sizeof(bool) == sizeof(char)) ? yes : no
thanks, however there may be more helpful answer because linux is open source
there may be someone who knows how that is coded

>> however there may be more helpful answer because linux is open source
That has nothing to do with it. A byte is a byte no matter what the operating system (although it is true that not all bytes are created equal -- they may have different number of bits).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.