摘要: 已经无法再精简,适合入门。 1 #include 2 #include 3 4 #include 5 #include 6 #include 7 #include 8 struct mengc_dev{ 9 char data[64];10 struct cdev... 阅读全文
posted @ 2014-05-22 11:28 宇睿 阅读(242) 评论(1) 推荐(0) 编辑
  2016年9月24日
摘要: windows控制台输入,默认是以文本模式打开,即使重定向输入,文本模式不变,所以输入时无法读到cr,因为windows已经把crlf转换成单个lf。 如果freopen("CON", "rb",stdin); 则可以读到cr fgets会吸收换行,但是换行也被写入字符串 如果不要字符串,scanf 阅读全文
posted @ 2016-09-24 16:12 宇睿 阅读(284) 评论(0) 推荐(0) 编辑
  2016年5月22日
摘要: #include<stdio.h>void f(){ }__attribute__((constructor)) void before(){ printf("Hello\n");} 安装glibc-debug之前 (gdb) bt#0 0x00007ffff7bd9702 in before () 阅读全文
posted @ 2016-05-22 21:49 宇睿 阅读(470) 评论(0) 推荐(0) 编辑
  2014年5月22日
摘要: 不能再简化 1 #include 2 #include 3 4 #include 5 #include 6 #include 7 void * meng_seq_start(struct seq_file*s,loff_t*pos) 8 { 9 if(*pos>1)10 ... 阅读全文
posted @ 2014-05-22 18:01 宇睿 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 不能再简化了#include#include#includeint meng_read_proc(char*page,char**start,off_t offset,int count,int*eof,void*data){ char*s="Hello. This is meng p... 阅读全文
posted @ 2014-05-22 17:14 宇睿 阅读(190) 评论(0) 推荐(0) 编辑
  2013年12月26日
摘要: #include using namespace std;int X[10][10][10];int flag[10][10];int sol[10][10];int N=81;int hasValueFlag[10][10];int check(int n){ int baseRow,baseCol; int row=n/9+1; int col=n%9+1; int i; int j; for (i=1;i>t; sol[i][j]=t; if(t!=0) { ... 阅读全文
posted @ 2013-12-26 23:48 宇睿 阅读(220) 评论(0) 推荐(0) 编辑
  2013年9月21日
摘要: class Solution {public: vector spiralOrder(vector > &matrix) { // Start typing your C/C++ solution below // DO NOT write int main() function int m,n; int cir; int i,j; vector re; if(matrix.size()==0) return re; m=matri... 阅读全文
posted @ 2013-09-21 17:26 宇睿 阅读(144) 评论(0) 推荐(0) 编辑
  2013年9月13日
摘要: class Result_to_user {public: string s_value[10]; int int_value[10]; static int member_count; static int isString[20];} ; int Result_to_user::member_count=0; int Result_to_user::isString[20];#define CMP_RESULT_TO_USER(i) bool cmp_result_to_user_string_##i (const Result_to_user&v1,co... 阅读全文
posted @ 2013-09-13 22:30 宇睿 阅读(222) 评论(0) 推荐(0) 编辑
  2013年7月13日
摘要: C++调用约定和名字约定转自http://www.cppblog.com/mzty/archive/2007/04/20/22349.html调用约定:__cdecl __fastcall与 __stdcall,三者都是调用约定(Calling convention),它决定以下内容:1)函数参数的压栈顺序,2)由调用者还是被调用者把参数弹出栈,3)以及产生函数修饰名的方法。1、__stdcall调用约定:函数的参数自右向左通过栈传递,被调用的函数在返回前清理传送参数的内存栈,2、_cdecl是C和C++程序的缺省调用方式。每一个调用它的函数都包含清空堆栈的代码,所以产生的可执行文件大小会比调 阅读全文
posted @ 2013-07-13 14:47 宇睿 阅读(349) 评论(0) 推荐(0) 编辑
  2013年7月12日
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 9 int X[8];10 int c=0;11 bool place(int k)12 {13 int i;14 for (i=0;i=0)38 {39 X[k]++;40 while (X[k]<8&&place(k)==false)41 {42 X[k]++;43 }44 if (X[... 阅读全文
posted @ 2013-07-12 15:30 宇睿 阅读(235) 评论(0) 推荐(0) 编辑