随笔分类 -  C++/C基础

摘要:这是GCC版本5.x的情况下的分析,在GCC版本4.x的情况下std::string的内存布局将不同。逆向C++的过程中经常遇到std::string,它在内存中的状态是什么样呢?我先简单地写了一个程序,里面用到了string,使用:clang++ -Xclang -fdump-record-lay 阅读全文
posted @ 2017-02-13 20:41 简单地快乐 阅读(2240) 评论(0) 推荐(0) 编辑
摘要:第一题Range关键:二分查找,查找不大于一个数的最大下标。 1 #include 2 #include 4 int compare (const void * a, const void * b){ 5 return ( *(int*)a - *(int*)b ); 6 } 7 in... 阅读全文
posted @ 2015-04-09 23:53 简单地快乐 阅读(307) 评论(0) 推荐(0) 编辑
摘要:大家在参加ACM比赛或者参加c/c++实验技能竞赛的时候,如果遇到大量的输入和大量的输出时,调试起来很不方便。一来如果结果不正确的话,需要重复输入大量数据;二来如果大量输出的话,得仔细检查输出结果与正确答案是否一样。这两项任务有时让人很不舒服。 我们可以利用freopen()函数来重定向流,可以使调试起来更加简单方便。 一个简单的例子:#include #include using namespace std; int main() { int a; int b; freopen("in.txt", "r", stdin); freo... 阅读全文
posted @ 2014-04-04 17:02 简单地快乐 阅读(429) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示