Location:
Search - unistd.h
Search list
Description: 基于终端的订花系统_socket
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
#include<sys/ipc.h>
#include<unistd.h>
#include<sys/shm.h>
#include<sys/stat.h>
#define MYPORT 3490 // num of port
#define BACKLOG 5 // largest num of accept
#define MAXDATASIZE 1-based terminal Dinghua system _socket # include
Platform: |
Size: 3930 |
Author: xxf |
Hits:
Description: 学会对文件的记录锁定,及解锁。#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
int fd
int i
struct {
char name[20]
uint ID
int age
} myrec
fd =open(\"name\", O_RDWR|O_CREAT, 0755)
if (fd == -1) return -1
printf(\"Input your name:\") scanf(\"%s\", myrec.name)
printf(\"Inpute your ID :\") scanf(\"%d\", &myrec.ID)
printf(\"Input your age :\") scanf(\"%d\", &myrec.age)
lseek(fd, 0,SEEK_END)
lockf(fd, 1, 0)
write(fd, (void *)&myrec, sizeof(myrec))
lockf(fd, 0 ,0)
return 0
}
执行命令cc lock.c –o lock.out
Chmod +x lock.out
./lock.out
Platform: |
Size: 9297 |
Author: 华羿 |
Hits:
Description: linux 下串口编程
#include <stdio.h> /*标准输入输出定义*/
#include <stdlib.h> /*标准函数库定义*/
#include <unistd.h> /*Unix标准函数定义*/
#include <sys/types.h> /**/
#include <sys/stat.h> /**/
#include <fcntl.h> /*文件控制定义*/
#include <termios.h> /*PPSIX终端控制定义*/
#include <errno.h> /*错误号定义*/
/***@brief 设置串口通信速率
*@param fd 类型 int 打开串口的文件句柄
*@param speed 类型 int 串口速度
*@return void*/
Platform: |
Size: 5289 |
Author: Edward |
Hits:
Description: 基于终端的订花系统_socket
#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
#include<sys/ipc.h>
#include<unistd.h>
#include<sys/shm.h>
#include<sys/stat.h>
#define MYPORT 3490 // num of port
#define BACKLOG 5 // largest num of accept
#define MAXDATASIZE 1-based terminal Dinghua system _socket# include
Platform: |
Size: 4096 |
Author: xxf |
Hits:
Description: 学会对文件的记录锁定,及解锁。#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main()
{
int fd
int i
struct {
char name[20]
uint ID
int age
} myrec
fd =open("name", O_RDWR|O_CREAT, 0755)
if (fd == -1) return -1
printf("Input your name:") scanf("%s", myrec.name)
printf("Inpute your ID :") scanf("%d", &myrec.ID)
printf("Input your age :") scanf("%d", &myrec.age)
lseek(fd, 0,SEEK_END)
lockf(fd, 1, 0)
write(fd, (void *)&myrec, sizeof(myrec))
lockf(fd, 0 ,0)
return 0
}
执行命令cc lock.c –o lock.out
Chmod +x lock.out
./lock.out
Platform: |
Size: 9216 |
Author: 华羿 |
Hits:
Description: linux 下串口编程
#include <stdio.h> /*标准输入输出定义*/
#include <stdlib.h> /*标准函数库定义*/
#include <unistd.h> /*Unix标准函数定义*/
#include <sys/types.h> /**/
#include <sys/stat.h> /**/
#include <fcntl.h> /*文件控制定义*/
#include <termios.h> /*PPSIX终端控制定义*/
#include <errno.h> /*错误号定义*/
/***@brief 设置串口通信速率
*@param fd 类型 int 打开串口的文件句柄
*@param speed 类型 int 串口速度
*@return void*/
-linux serial port programming under# include
Platform: |
Size: 5120 |
Author: Edward |
Hits:
Description: #include<stdio.h>
#include<string.h>
#include<limits.h>
#include<unistd.h>
#include<sys/types.h>
#define PROMPT_STRING "[myshell]$"
#define QUIT_STRING "exit\n"
static char inbuf[MAX_CANON]
char * g_ptr
char * g_lim
extern void yylex()
int main (void){
for( ){
if(fputs(PROMPT_STRING,stdout)==EOF)
continue
if(fgets(inbuf,MAX_CANON,stdin)==NULL)
continue
if(strcmp(inbuf,QUIT_STRING)==0)
break
g_ptr = inbuf
g_lim = inbuf + strlen(inbuf)
yylex()
}
return 0
}
-# Include <stdio.h># Include <string.h># Include <limits.h># Include <unistd.h># Include <sys/types.h># Define PROMPT_STRING [myshell] $ # define QUIT_STRING exit static char inbuf [MAX_CANON] char* g_ptr char* g_lim extern void yylex () int main (void) (for () (if (fputs (PROMPT_STRING, stdout) == EOF) continue if (fgets (inbuf, MAX_CANON, stdin) == NULL) continue if (strcmp (inbuf, QUIT_STRING) == 0) break g_ptr = inbuf g_lim = inbuf+ strlen (inbuf) yylex ()) return 0)
Platform: |
Size: 32768 |
Author: 李明 |
Hits:
Description: 帧缓冲#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <asm/page.h>
#include <linux/fb.h>
#define TRUE 1
#define FALSE 2
//a framebuffer device structure
typedef struct fbdev{
int fb
unsigned long fb_mem_offset
unsigned long fb_mem
struct fb_fix_screeninfo fb_fix -Frame buffer# Include <stdio.h># Include <stdlib.h># Include <string.h># Include <stdint.h># Include <unistd.h># Include <fcntl.h># include <sys/ioctl.h># include <sys/mman.h># include <asm/page.h># include <linux/fb.h># define TRUE 1# define FALSE 2// a framebuffer device structure typedef struct fbdev (int fb unsigned long fb_mem_offset unsigned long fb_mem struct fb_fix_screeninfo fb_fix
Platform: |
Size: 1024 |
Author: hjintian |
Hits:
Description: include <stdio.h> /*标准输入输出定义*/
#include <stdlib.h> /*标准函数库定义*/
#include <unistd.h> /*Unix标准函数定义*/
#include <sys/types.h> /**/
#include <sys/stat.h> /**/
#include <fcntl.h> /*文件控制定义*/
#include <termios.h> /*PPSIX终端控制定义*/
#include <errno.h> /*错误号定义*/
#define TRUE 1
#define FALSE 0
/***@brief 设置串口通信速率
*@-include <stdio.h>/* Standard input and output definitions* /# include <stdlib.h>/* Standard function library definition* /# include <unistd.h>/* Unix standard function definition* /# include <sys/types.h>/** /# Include <sys/stat.h>/** /# Include <fcntl.h>/* File control definition* /# include <termios.h>/* PPSIX terminal control definitions* /# include <errno.h>/* Error number definitions* /# define TRUE 1# define FALSE 0 /***brief set of serial communication rate* @
Platform: |
Size: 9216 |
Author: nameblue |
Hits:
Description: client socket
include <sys/types.h>
include <sys/socket.h>
include <stdio.h>
include <netinet/in.h>
include <arpa/inet.h>
include <unistd.h>
int main()
{
int sockfd
int len
struct sockaddr_in address
int result
char ch = A
sockfd = socket(AF_INET, SOCK_STREAM, 0)
address.sin_family = AF_INET
address.sin_addr.s_addr = inet_addr("127.0.0.1")
address.sin_port = 9734
len = sizeof(address)
result = connect(sockfd, (struct sockaddr *)&address, len)
if(result == -1) {
perror("oops: client")
exit(1)
}
write(sockfd, &ch, 1)
read(sockfd, &ch, 1)
printf("char from server = c\n", ch)
close(sockfd)
exit(0)
}
-client socket
include <sys/types.h>
include <sys/socket.h>
include <stdio.h>
include <netinet/in.h>
include <arpa/inet.h>
include <unistd.h>
int main()
{
int sockfd
int len
struct sockaddr_in address
int result
char ch = A
sockfd = socket(AF_INET, SOCK_STREAM, 0)
address.sin_family = AF_INET
address.sin_addr.s_addr = inet_addr("127.0.0.1")
address.sin_port = 9734
len = sizeof(address)
result = connect(sockfd, (struct sockaddr*)&address, len)
if(result ==-1) {
perror("oops: client")
exit(1)
}
write(sockfd, &ch, 1)
read(sockfd, &ch, 1)
printf("char from server = c\n", ch)
close(sockfd)
exit(0)
}
Platform: |
Size: 1024 |
Author: nabilnapel |
Hits:
Description: 针对由系统调用sbrk()申请得到的内存区域进行管理,实现了用户中申请、释放内存过程。整个程序由头文件malloc.h、分配与释放模块malloc.c、应用程序test.c和工程文件makefile共四个文件组成,该程序已在linux下成功调试通过-include <unistd.h>
#include "my_malloc.h"
static Header base /* empty list to get started*/
static Header*free_list = NULL /* start of free list*/
/* Malloc: general-purpose storage allocator*/
void*
Malloc(unsigned int nbytes)
{
Header*p,*prev
unsigned int nunits
nunits = (nbytes+ sizeof(Header)- 1)/sizeof(Header)+ 1
if ( (prev = free_list) == NULL) { /* no free list yet*/
Platform: |
Size: 9216 |
Author: jjl |
Hits:
Description: watchdog 这是一个例程!可以参考一下!-#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/io.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
Platform: |
Size: 1024 |
Author: 占 |
Hits:
Description: Bluetooth xfu flash
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
#include <string.h>
#include <assert.h>
#include <stdarg.h>
#include "dfu.h"
Platform: |
Size: 5120 |
Author: ulego |
Hits:
Description: C++ 进程函数实例。<unistd.h>头文件功能函数相关解析。-C++ examples of the process of a function. <unistd.h> Header file utility functions related to parsing.
Platform: |
Size: 2048 |
Author: 方林 |
Hits:
Description: visual c++ 线程函数实例;
<unistd.h>头文件相关函数功能说明。-visual c++ thread example of a function <unistd.h> Function Description header file related functions.
Platform: |
Size: 2048 |
Author: 方林 |
Hits:
Description: Zlib压缩算法,可在BCB下和VC下使用,附dll工程,直接用VC可编译成dll,可在其它开发环境下使用-Zlib compression algorithm can be under BCB and VC to use, with a dll project, the direct use of VC can be compiled into a dll, can be used in other development environments
Platform: |
Size: 566272 |
Author: daily |
Hits:
Description: Linux下的端口扫描实现
f (!connect(sockfd,(struct sockaddr*)&server,sizeof(struct sockaddr-
#include<stdlib.h>
#include<stdio.h>
#include<sys/socket.h>
#include<netdb.h>
#include<string.h>
#include<unistd.h>
#include<netinet/in.h>
#include<arpa/inet.h>
Platform: |
Size: 1024 |
Author: david |
Hits:
Description: HTTP协议的C语言编程实现实例 HTTP协议的C语言编程实现实例 HTTP协议的C语言编程实现实例-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <netinet/in.h>
#include <limits.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <ctype.h>
Platform: |
Size: 3072 |
Author: zyh |
Hits:
Description: Linux 系统串口使用代码
/*
* Program: serial.c
* Author: Paul Dean
* Version: 0.0.3
* Date: 2002-02-19
* Description: To provide underlying serial port function,
* for high level applications.
*
*/
#include <termios.h> /* tcgetattr, tcsetattr */
#include <stdio.h> /* perror, printf, puts, fprintf, fputs */
#include <unistd.h> /* read, write, close */
#include <fcntl.h> /* open */
#include <sys/signal.h>
#include <sys/types.h>
#include <string.h> /* bzero, memcpy */
#include <limits.h> /* CHAR_MAX */
#include "vardef.h" /* INT32, INT16, INT8, UINT32, UINT16, UINT8 */
#include "serial.h"-This directory contains the version 0.0.4 release of the Serial Debugger (SDB).
The SDB is free software. If you think it is useful in your applications or solutions, you are admitted to use this source code with the declaration of Copyright to the original author, now Ding Baohua.
Install procedure is referred to INSTALL file.
Platform: |
Size: 8192 |
Author: zhangxiaojun |
Hits:
Description: this the header file for using socket communication conccepts in unistd.h
unistd.h header file is used for tyhe communication maachines-this is the header file for using socket communication conccepts in unistd.h
unistd.h header file is used for tyhe communication maachines..
Platform: |
Size: 1024 |
Author: rajv |
Hits: