fork download
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <fstream>
  4.  
  5. //converts hex into base10
  6. unsigned long convertHexToIntBase10(char* inputHex)
  7. {
  8. unsigned long hexValue = std::strtoul(inputHex, 0, 16);
  9. return hexValue;
  10. }
  11.  
  12. int main(int argc, char* argv[])
  13. {
  14. if(argc < 3){
  15. std::cerr << "Usage: MemoryPageListHex [Low Memory Adress] [High Memory Adress] in 4k Pages i.e. MemoryPageListHex 1bae50 1bb0e7 for 0x1bae50148 to 0x1bb0e7fe8" << std::endl;
  16. return 0;
  17. }
  18. auto lowAdr = convertHexToIntBase10(argv[1]);
  19. auto highAdr = convertHexToIntBase10(argv[2]);
  20. std::ofstream myfile;
  21. myfile.open ("MemoryAdress4k.txt");
  22. for (auto i=lowAdr; i<highAdr; i++){
  23. myfile << std::hex << "0x" << i << " ";
  24. }
  25. myfile.close();
  26. return 0;
  27. }
Success #stdin #stdout #stderr 0.01s 5284KB
stdin
177000 1B5800
stdout
Standard output is empty
stderr
Usage: MemoryPageListHex [Low Memory Adress] [High Memory Adress] in 4k Pages i.e. MemoryPageListHex 1bae50 1bb0e7 for 0x1bae50148 to 0x1bb0e7fe8