编程语言-C
文章平均质量分 67
jxluoix
能够自己独立开发中小型的软件系统;
对工作态度认真、执着、诚恳;勇于专研、探索、创新;
接受新事物快、见识宽广.
展开
-
网络编程-SOCKET-创建SOCKET-WINDOWS下socket函数声明问题
今天翻了下VC下SOCKET头文件WINSOCK2.H,又看了下socket函数的声明: #if INCL_WINSOCK_API_PROTOTYPESWINSOCK_API_LINKAGESOCKETWSAAPIsocket( int af, int type, int protocol );#endif // INCL_WIN...原创 2012-08-10 00:18:44 · 530 阅读 · 0 评论 -
C Run-Time Library _beginthread, _beginthreadex to create thread
#ifndef _MT#error "Compiler linking options /MT not specific"#endif #include <stdio.h>#include <windows.h>#include <process.h> void start_address(void *arg){prin...2014-04-15 19:06:24 · 139 阅读 · 0 评论 -
C/C++中嵌入LUA脚本(C/C++与LUA相互交互调用)-2
/* * * * @author ada * @version 1.0 * @since 1.0 */#include <log.h>#include "../LuaRuntime.hpp"#include "../Task.hpp"#include "../../LinkedLibrary.h" LuaRuntime *runtim...2014-04-16 23:07:39 · 161 阅读 · 0 评论 -
g++ -v --help
Usage: g++ [options] file...Options: -pass-exit-codes Exit with highest error code from a phase --help Display this information --target-help Display ...原创 2016-09-30 01:07:16 · 1670 阅读 · 0 评论 -
C/C++ offsetof编译问题
#include <stdlib.h>#include <stddef.h> #include <stdio.h>struct Entry{int key;int value;struct Entry *next;}; typedef struct Entry Entry_t; class BEntry...原创 2016-09-30 01:07:45 · 732 阅读 · 0 评论 -
Nonblocking Concurrent Objects with Condition Synchronization
Nonblocking Concurrent Objects with Condition Synchronization", by W. N. Scherer III and M. L. Scott. 18th Annual Conf. on Distributed Computing, Oct. 2004 http://www.cs.rochester.edu/u/scott/s...原创 2016-12-28 16:39:26 · 178 阅读 · 0 评论 -
一张有关io的图片
一张有关io的图片原创 2017-05-20 20:48:21 · 181 阅读 · 0 评论 -
tcp_v4_init
void __init tcp_v4_init(struct net_proto_family *ops){ int err = sock_create(PF_INET, SOCK_RAW, IPPROTO_TCP, &tcp_socket); if (err < 0) panic("Failed to create the TCP control sock...2017-05-21 01:12:51 · 160 阅读 · 0 评论 -
icmp_init
void __init icmp_init(struct net_proto_family *ops){ struct inet_opt *inet; int i; for (i = 0; i < NR_CPUS; i++) { int err; if (!cpu_possible(i)) continue; err = sock...2017-05-21 01:17:09 · 128 阅读 · 0 评论 -
一些有关PEM(PEM_read)的代码
typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long); struct crypto_ex_data_st { STACK_OF(void) *sk; int dummy; /* gcc is screwi...2017-05-24 23:31:54 · 610 阅读 · 0 评论 -
linux mount
#include <stdio.h>#include <stdlib.h>#include <sys/mount.h>#include <sys/types.h>#include <unistd.h>#undef _POSIX_SOURCE#include <linux/capability.h&...2017-06-04 01:39:01 · 93 阅读 · 0 评论 -
JVM中一种random实现
long _rand_seed = 1; void init_random(long initval) { _rand_seed = initval;} long random() { /* standard, well-known linear congruential random gene...2017-07-13 00:05:45 · 344 阅读 · 0 评论 -
随便一点代码
#include <stdio.h>#include <string.h>#include <errno.h>#include <assert.h>#include <netdb.h>#define __DEBUG__ void printf_protoent(struct protoent* ...2017-10-29 23:56:29 · 284 阅读 · 0 评论 -
随便一点代码
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>#include <assert.h>#include <sys/types.h>#include <sys/socket.h>2017-11-04 04:34:10 · 207 阅读 · 0 评论 -
随便一点代码
/* * $ gcc -c selecttest.c -o selecttest.o * $ gcc selecttest.o -o selecttest */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <errno.h>...2017-11-11 22:56:18 · 231 阅读 · 0 评论 -
C/C++中嵌入LUA脚本(C/C++与LUA相互交互调用)
/* * * * @author ada * @version 1.0 * @since 1.0 */#include <stdio.h>#include <string.h>#include <log.h>#include "../gs/LuaContext.hpp"#include "../gs/LuaExec...原创 2014-04-11 00:00:12 · 444 阅读 · 0 评论 -
Windows Make file(VC, NMAKE)
DEBUG=../DebugPATH_VS=D:\usr\bin\Microsoft Visual Studio\VC98CL="$(PATH_VS)\Bin\cl.exe"LINK="$(PATH_VS)\Bin\link.exe" INCLUDE="D:\usr\bin\Microsoft Visual Studio\VC98\Include"LIB="D:\usr\...2014-04-08 00:24:29 · 108 阅读 · 0 评论 -
通信_网络编程_WINDOWS下网络编程_SOCKET编程_VC中WINSOCK2.H头文件SOCKET
<!-- [if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:DrawingGri原创 2012-08-10 01:02:54 · 496 阅读 · 0 评论 -
C/C++-Windows平台Win32编程-Windows API-HINSTANCE
HINSTANCE WTYPES.H头文件中定义如下: typedef void __RPC_FAR *HINSTANCE; HINSTANCE是“句柄型”数据类型, 从WTYPES.H中定义来看, 它其实就是一个void的指针类型void *. HINSTANCE在使用有其特殊的含义, 跟void *的应用不同, 它是作为程序运行实例(当前实例, 就类似于进程)的一个句柄...2012-08-26 20:32:12 · 347 阅读 · 0 评论 -
C/C++-Windows平台Win32编程-Windows API-WinMain
WinMain Windows平台下Win32应用程序的入口, 就类似C/C++的入口函数int main(int argc, char* argv[]). 该入口函数原型定义在WINBASE.H头文件中定义如下:#ifndef _MACintWINAPI#elseintCALLBACK#endifWinMain( HINSTANCE h...2012-08-26 20:55:12 · 249 阅读 · 0 评论 -
OPENSSL API RSA ENCRYPT & DECRYPT
// test.cpp// // @author ada// @version 1.0 2015-01-10#include "stdafx.h"#include<stdio.h>#include<stdlib.h>#include<string.h>#include<openssl/rsa.h>#include<openssl/pem.h&...2015-01-18 19:29:42 · 207 阅读 · 0 评论 -
Windows CryptoAPI
// win32-test.cpp : 定义控制台应用程序的入口点。// // Defines the entry point for the console // application.#include "stdafx.h"#include <tchar.h>#include <stdio.h>#include <windows.h>#include <...2015-01-24 18:20:08 · 214 阅读 · 0 评论 -
socket select programing
#pragma comment(lib,"ws2_32.lib") #include <stdio.h>#include <string.h>#include <WINSOCK2.H> #include <log.h>#include "socket/HardSocket.h"#include "socket/L原创 2014-03-05 21:20:41 · 99 阅读 · 0 评论 -
socket poll programing
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <poll.h>#include <sys/time.h>#include <netinet/in.h>#in原创 2014-03-06 18:05:37 · 107 阅读 · 0 评论 -
VC命令行环境下生成.DLL, .LIB库
创建make文件 Makefile.nmake make文件内容 DEBUG=./Debug liblog.lib:#"D:\usr\bin\Microsoft Visual Studio\VC98\Bin\cl.exe" /GX /W3 /I "D:\usr\bin\Microsoft Visual Studio\VC98\Include" /c ...原创 2014-03-06 23:52:34 · 213 阅读 · 0 评论 -
Windows下C/C++ 多线程同步(mutex)
#ifndef __LOCK#define __LOCK class Lock{public: virtual void lock() = 0; virtual void unlock() = 0;}; #endif ======================================= #include <windo...2014-03-28 22:49:32 · 630 阅读 · 0 评论 -
Windows下C/C++ 多线程同步(event)
#ifndef __LOCK#define __LOCK class Lock{public: virtual void lock() = 0; virtual void unlock() = 0;}; #endif =========================================================== ...2014-03-28 22:56:09 · 202 阅读 · 0 评论 -
Windows下C/C++ 多线程同步
#include "Lock.hpp"#include "EventLock.hpp" #ifndef __SYNC#define __SYNCclass Sync {private: protected: EventLock *lock; EventLock *block; public: Sync(); void w...2014-03-29 00:45:11 · 287 阅读 · 0 评论 -
C++ Observer 实现
#include <vector>#include "Observer.hpp" #ifndef OBSERVABLE#define OBSERVABLEclass Observable{private:std::vector<Observer *> observers; public:Observable(); voi...2014-03-30 15:25:33 · 172 阅读 · 0 评论 -
Linux下C/C++ 多线程同步
#include <pthread.h>#include "PosixMutexLock.hpp" #ifndef POSIX_SYNC#define POSIX_SYNCclass PosixSync {private: protected: PosixMutexLock *lock; pthread_cond_t block;...2014-04-02 23:01:06 · 213 阅读 · 0 评论 -
pthread_exit & pthread_join 有一种被骗了的感觉!
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <pthread.h> int *exitStatus = NULL;int count = 0; void* run_up(void *arg){printf("&...2014-04-07 00:39:00 · 146 阅读 · 0 评论 -
通过设置GCC编译参数-fpack-struct[=N]指定内存对齐
通过设置GCC编译参数-fpack-struct[=N]指定内存对齐 举个例子:#include <stdio.h>#include <stdlib.h>#include <stddef.h> struct test_s { int i; char c; double d; char a[];...2017-03-20 17:20:54 · 1135 阅读 · 0 评论