c - C语言读取内存

标签 c memory

我在微 Controller 上工作, 我想在执行代码后读取内存的内容。 我知道要读取的内存地址和大小 我试过这个方法:

    const volatile unsigned char *const mem_start = 0xd0000000;

    #define size ((ptrdiff_t)0x1c000)

    unsigned char buff[size];
    ptrdiff_t j;

    for(j =0 ; j< sizeof(buff) ; j++)
    buff[i]= *(mem_start + j);

我正在寻找另一种方法来读取内存而不将其复制到缓冲区中,在我想要读取它的同一内存中,冒着破坏我正在寻找的内容的风险。并且 buff 可能会因空间不足而重叠

最佳答案

在声明中

...= *(mem_start + j);

正在阅读内存。那你还想要什么?


对了,你怎么没用

mem_start[j]; ??

关于c - C语言读取内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56873108/

相关文章:

c - "STACK"之前的预期表达式错误

C++ : terminate called after throwing an instance of 'std::bad_alloc' while computing length of big strings

Android Studio - 旋转设备导致使用越来越多的内存

ios - NSMutableString 的内存问题

C 将 unsigned char 转换为 unsigned char : 4

c - 使用 malloc() 创建字符数组时抛出异常

c - "for"循环出错,我认为是内存问题

C 下标值既不是数组也不是指针也不是 vector

c - 如何保护Linux中进程间共享的内存

c++ - 当您从 C++ 函数返回引用时会发生什么?