linux heapdump_oracle dump函数

linux heapdump_oracle dump函数#include#include#include#include//http://androidxref.com/7.1.1_r6/xref/external/avahi/avahi-compat-howl/text-test.c#33staticvoidhexdump(constvoid*p,size_tsize){constuint8_t*c=p;assert(p…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

#include

#include

#include

#include

//http://androidxref.com/7.1.1_r6/xref/external/avahi/avahi-compat-howl/text-test.c#33

static void hexdump(const void* p, size_t size) {

const uint8_t *c = p;

assert(p);

printf(“Dumping %u bytes from %p:\n”, size, p);

while (size > 0) {

unsigned i;

for (i = 0; i < 16; i++) {

if (i < size)

printf(“%02x “, c[i]);

else

printf(” “);

}

for (i = 0; i < 16; i++) {

if (i < size)

printf(“%c”, c[i] >= 32 && c[i] < 127 ? c[i] : ‘.’);

else

printf(” “);

}

printf(“\n”);

c += 16;

if (size <= 16)

break;

size -= 16;

}

}

//默认8的倍数对齐 4+1+10=15=>16

typedef struct Person

{

int age;

char sex;

char city[10];

} Person;

//默认8的倍数对齐 4+4+10=18=>24

typedef struct Student2

{

Person* parent; //4 //存在指针到文件中的话,指针对应的数据会丢失,因为你只存储了他的地址,没有保存他的数据

int weight;//4

char classroom[10];//10+6

} Student2;

int main(void)

{

Person person;

person.age=26;

person.sex=’m’;

strcpy(person.city,”shenzhen”);

hexdump(&person,sizeof(person));

Student2 stu;

stu.parent=&person;//16

stu.weight=140;

memset(stu.classroom,0,sizeof(stu.classroom));//清零,否则是随机值

strcpy(stu.classroom,”204″);

hexdump(&stu,sizeof(stu));

FILE* fp=fopen(“student2.struct.bin”,”wb”);

fwrite(&stu,sizeof(stu),1,fp);

fclose(fp);

printf(“write_Student2_struct sizeof=%d ok!\n”,sizeof(stu));//24

printf(“Hello World!\n”);

return 0;

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/193138.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 在eclipse中拉取github互联网上的代码

    在eclipse中拉取github互联网上的代码

    2021年7月17日
    69
  • tess4j3.2.1识别中英文

    tess4j3.2.1识别中英文1.测试代码publicclassTesseractExample{ publicstaticvoidmain(String[]args)throwsException{ //1.本地 //FileimageFile=newFile("C:\\wangl\\eurotext.tif"); //InputStreamis=…

    2022年6月6日
    34
  • C++异常处理建议收藏

    一C++异常处理机制异常处理基本思想:执行一个函数的过程中发现异常,可以不用再本函数内立即进行处理,而是抛出该异常,让函数的调用者直接或间接的处理这个问题。C++异常处理进制由三个模块组成:tr

    2021年12月19日
    40
  • mysql实现类似rownumber()的效果

    mysql实现类似rownumber()的效果–Createtesttablecreatetabletmp_test(empidint,deptidint,salarydecimal(10,2));–Inserttestdatainsertintotmp_testvalues(1,10,5500.00),(2,10,4500.00),(3,20,1900.00),(4,20,

    2022年5月21日
    50
  • RabbitMQ消费消息坑:failed to convert serialized Message content

    RabbitMQ消费消息坑:failed to convert serialized Message content文章目录一、问题描述二、解决方案方案一:共同使用一个对象方案二:消息JSON序列化(推荐)2.1.生产者发送消息JSON序列化2.2.消费者接收消息JSON反序列化三、测试一、问题描述2022-05-0314:01:40.630WARN16876—[ntContainer#0-2]s.a.r.l.ConditionalRejectingErrorHandler:ExecutionofRabbitmessagelistenerfailed.org.springfram

    2022年6月16日
    630
  • 免备案cdn_cdn贝安装

    免备案cdn_cdn贝安装免备案CDN,符码CDN应该是使用CDN贝搭建,该CDN系统相对来说比较成熟,功能支持比较丰富。今天对符码免备案CDN进行简单的测试,仅供大家参考。首先,就是简单粗暴的多地区PING大法,简单看下CDN延迟效果:如果要是对比那么多免备案CDN延迟来说,符码CDN平均可以做到45ms的延迟,无疑是测试的所有免备案CDN中多地区PING平均延迟最小的一个,甚至一些国内CDN也达不到这个低延迟效果,延迟…

    2022年9月3日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号