need little help form you guys
i just wanna to cheak if the byte is readable or not, i have search for sulution but not find
hope you will help me
i have this code i need if tag that cheak if byte is readable
#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <stdio.h>
void main()
{
float ramsize;
char *ch;
unsigned int j=128,readbyte;
long i;
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex);
ramsize = statex.ullTotalPhys;
for(i=0;i<ramsize;i = i+1)
{
ch = (char*) i;
readbyte = *ch;
// if readbyte is readable
printf("you have readable byte in address: %x , that contain in Binary:",&readbyte);
for(i=0;i<8;i++)
{
if(readbyte&j)
printf("1");
else
printf("0");
j=j>>1;
}
putchar('\n');
// if readbyte is not readable
printf("Sorry: you cant read this byte: %x",&readbyte);
}
}
If a byte is not readable the OS will send a signal to your process. You need to catch that signal or your program will terminate.
Read up on signals in your course textbook.