//使用fcntl对文件进行加锁#include "stdio.h"#include "unistd.h"#include "fcntl.h"intmain(){ intfd; structflocklk; intr; fd=open("a.txt",O_RDWR); if(fd==-1) { fd...
分类:
编程语言 时间:
2014-12-23 12:02:14
阅读次数:
438
#include?<stdio.h>
#include?<stdlib.h>
#include?<string.h>
char?*mcopy(char?*dst?,?const?char?*src?){
char?*ret?=?dst?;
while(*src?!=?‘\0‘){
*dst?++?=?*src?++?;
}
*dst?...
分类:
其他好文 时间:
2014-12-22 21:24:10
阅读次数:
178
示例1:#include "stdio.h"void main(){ enum {Mon, Tue, Wed, Thr, Fri, Sat, Sun}; printf("Mon = %d\n", Mon); printf("Tue = %d\n", Tue); printf("Wed = %d\n"...
分类:
编程语言 时间:
2014-12-20 15:32:09
阅读次数:
156
#include<stdio.h>intx=77;/*全局变量x*/voidfn1(){externinty;/*使用外部全局变量y,如果不加extern编译不通过*/printf("fn1():x=%d,y=%d\n",x,y);//x=77,y=88;}voidfn2(){externinty;/*使用外部全局变量y,如果不加extern编译不通过*/y=888;/*修改外部全局变量y为888*/pr..
分类:
编程语言 时间:
2014-12-19 19:23:29
阅读次数:
200
#include <cstdlib> #include <iostream> #include <time.h> #include <stdio.h> using namespace std; int main(int argc, char *argv[]) { ? ? time_t tNow =time(NULL); ? ? time_t tEnd = tNow + 2500; ?...
分类:
其他好文 时间:
2014-12-19 16:01:25
阅读次数:
180
#include<stdio.h>
classA
{
//int*b[65536][32][32];
int*(&b)[65536][32][32];
intm_t;
public:
A():
b(*newint*[1][65536][32][32])
{
//b=newint*[65536][32][32];
}
intfoo();
};
intA::foo()
{
m_t=100;
//b=newint*[65536][32][32];
}
intmain()
{
A*pa=ne..
分类:
数据库 时间:
2014-12-19 02:04:39
阅读次数:
200
printf函数 1)基本概念 printf函数是由C的编译系统提供的库函数,作用是向输出缓冲区输出内容 具体 stdio.h -- 标准的输入(scanf)输出(printf)的头文件 printf("xxxx");/ scanf("%d",&a); 2)使用 格式:printf("格式...
分类:
编程语言 时间:
2014-12-17 20:26:10
阅读次数:
173
IP字符串转换成可比较大小的数字,具体代码如下所示: 本文由www.169it.com搜集整理 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include "stdio.h" #include "arpa/inet.h" #include <string> using namespace std; // l...
分类:
编程语言 时间:
2014-12-17 16:36:01
阅读次数:
178
经典c程序100例==51--60【程序51】题目:学习使用按位与 & 。 1.程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=12.程序源代码:#include "stdio.h"main(){int a,b;a=077;b=a&3;printf("\40: The a & b(d.....
分类:
编程语言 时间:
2014-12-17 01:32:04
阅读次数:
164
原文:让你的Windows不断重启的C语言代码没有写Linux的原因是因为搞不定Linux下的权限问题,而Windows下基本上使用电脑的用户都是管理员,所以钻个空了,不多说下面是代码#include "stdio.h"#include "process.h"int copy_file(char *...
分类:
编程语言 时间:
2014-12-16 08:43:46
阅读次数:
174