Location:
Search - pragma
Search list
Description: 本人编写的关于Visual C++中编译指令#pragma的一些介绍,基本上涵盖了#pragma语句的常规性用法。-prepared by the Visual C compiler directive # pragma definitely, basically covering all the # pragma statement of the conventional usage.
Platform: |
Size: 9749 |
Author: 刘欢 |
Hits:
Description: 此为嵌入式数据库SQLite的一段源码,希望对嵌入式数据库SQLite的爱好者有所帮助-this SQLite embedded database for the section of source code, hope for embedded SQLite database enthusiasts help
Platform: |
Size: 6098 |
Author: wyp |
Hits:
Description: VC中预处理指令的详解
在所有的预处理指令中,#Pragma 指令可能是最复杂的了
Platform: |
Size: 3333 |
Author: 刘健 |
Hits:
Description: 第三方空间//--- --- --- --- --- --- ---
#include <vcl.h>
#pragma hdrstop
USERES(\"WinSkinC5.res\")
USEPACKAGE(\"vcl50.bpi\")
USEUNIT(\"WinSkinReg.pas\")
USERES(\"WinSkinReg.dcr\")
USEPACKAGE(\"vclx50.bpi\")
//---------------------------------------------------------------------------
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Package source.
//---------------------------------------------------------------------------
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1
}
//---------------------------------------------------------------------------
Platform: |
Size: 453473 |
Author: cehentao |
Hits:
Description: #if !defined(AFX_GAQUEEN_H__C26AE0A3_F9B4_426F_A324_B460CC7946CB__INCLUDED_)
#define AFX_GAQUEEN_H__C26AE0A3_F9B4_426F_A324_B460CC7946CB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CGAQueen
{
public:
CGAQueen(int nPopulation,int nIteration,float Mutation,int mChBoard)
virtual ~CGAQueen()
void Clear() // to clear chess board with 0 value
void InitialPopulation() // to create the first and initial randompopulation
void FillArea(int index) // to fill chess board with desired chromosome
int CostFunc(int index) // determine the cost of matrix[index][index]
void PopulationSort() // to sort population from the best to the worst
void GenerateCrossOverMatrix() // a way to create children from parent is CcrossOver
void Mating() // to create children from parents
void Ap
Platform: |
Size: 2628 |
Author: 王晓敬 |
Hits:
Description: 阐述#program几种常用使用规则。希望对于学习Visual C++的朋友有所帮助。
Platform: |
Size: 5063 |
Author: 张庆华 |
Hits:
Description: #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN
#define LOGFILE \"C:\\\\hookwsock.log\"
#include \"stdio.h\"
#include
#include
/*// IEXPLORE Droiyan Online \"IEFrame\"
#define NameClass \"IEFrame\"
#define TitleClass NULL
*/
Platform: |
Size: 2106 |
Author: liuchao |
Hits:
Description: pragma预处理指令详解,pragma指令对每个编译器给出了一个方法,
Platform: |
Size: 2471 |
Author: 陈志翔 |
Hits:
Description: 网上收集的常用pragma指令的用法,对于使用其他c++库很值得学习
Platform: |
Size: 23556 |
Author: zhangfaguang |
Hits:
Description: /* RSA Demo 1.0 版 * 版权所有 (C) 2004 赵春生 * 2004.04.25 * http://timw.yeah.net * http://timw.126.com * 本程序调用Miracl ver 4.82大数运算库,详见其附带手册。 * P,Q,N,D,E使用RSATool2生成。 */ 编译提示: 一:将Project-Settings-Settings For(All Configuration)-C/C++中Category项的 Precompiled Headers设置成:Automatic use of precompiled headers(图1)。 二:将ms32.lib添加到工程中(图2)。 三:MIRACL是C库。 extern \"C\" { #include \"miracl.h\" #include \"mirdef.h\" } #pragma comment( lib, \"ms32.lib\" )-/ * RSA Demo version 1.0 * Copyright (C) 2004 Zhao Chunsheng 2004.04.25 * * * http://timw.126.com http://timw.yeah.net * The procedures called Miracl ver 4. The majority of computing for 82, as detailed in its fringe manual. * P, Q, N, D, E use RSATool2 generation. * / Compiler Tip : 1 : Project-Settings - Settings For (All Configuration) - C / C Category, of OO Headers set : Automatic use of precompiled headers (Figure 1). 2 : ms32.lib added to the project (Figure 2). 3 : MIRACL C library. Extern "C" (# include "miracl.h" # include "mirdef.h") # pragma comment (lib, "ms32.lib")
Platform: |
Size: 342787 |
Author: 李湘 |
Hits:
Description: /* RSA Demo 1.0 版 * 版权所有 (C) 2004 赵春生 * 2004.04.25 * http://timw.yeah.net * http://timw.126.com * 本程序调用Miracl ver 4.82大数运算库,详见其附带手册。 * P,Q,N,D,E使用RSATool2生成。 */ 编译提示: 一:将Project-Settings-Settings For(All Configuration)-C/C++中Category项的 Precompiled Headers设置成:Automatic use of precompiled headers(图1)。 二:将ms32.lib添加到工程中(图2)。 三:MIRACL是C库。 extern \"C\" { #include \"miracl.h\" #include \"mirdef.h\" } #pragma comment( lib, \"ms32.lib\" )-/ * RSA Demo version 1.0 * Copyright (C) 2004 Zhao Chunsheng 2004.04.25 * * * http://timw.126.com http://timw.yeah.net * The procedures called Miracl ver 4. The majority of computing for 82, as detailed in its fringe manual. * P, Q, N, D, E use RSATool2 generation. * / Compiler Tip : 1 : Project-Settings - Settings For (All Configuration) - C / C Category, of OO Headers set : Automatic use of precompiled headers (Figure 1). 2 : ms32.lib added to the project (Figure 2). 3 : MIRACL C library. Extern "C" (# include "miracl.h" # include "mirdef.h") # pragma comment (lib, "ms32.lib")
Platform: |
Size: 172963 |
Author: 李湘 |
Hits:
Description: // dianbiao645.h : main header file for the DIANBIAO645 application
//
#if !defined(AFX_DIANBIAO645_H__EF43A0BD_87CA_4963_B57A_57851872D28C__INCLUDED_)
#define AFX_DIANBIAO645_H__EF43A0BD_87CA_4963_B57A_57851872D28C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
struct comm
{
char status,orde[3],address[7],len;
unsigned char crc_r,crc_t,flag;
};
extern struct comm comm2;
extern char zong[15],gu[15],ping[15];
/////////////////////////////////////////////////////////////////////////////
// CDianbiao645App:
// See dianbiao645.cpp for the implementation of this class
//
class CDianbiao645App : public CWinApp
{
public:
CDianbiao645App();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDianbiao645App)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CDianbiao645App)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DIANBIAO645_H__EF43A0BD_87CA_4963_B57A_57851872D28C__INCLUDED_)
Platform: |
Size: 352028 |
Author: 459777329@qq.com |
Hits:
Description: 一个判断远程主机存活程序代码(ping)
#include
#include
#include
#include
#include "winsock.h"
#pragma comment(lib,"Ws2_32");
#define SEND_SIZE 32
#define PACKET_SIZE 4096
#define ICMP_ECHO 8
#define ICMP_ECHOREPLY 0
struct icmp
{
unsigned char icmp_type;
unsigned char icmp_code;
unsigned short icmp_cksum;
unsigned short icmp_id;
unsigned short icmp_seq;
unsigned long icmp_data;
};
struct ip
{
unsigned char ip_hl:4;
unsigned char ip_v:4;
unsigned char ip_tos;
unsigned short ip_len;
unsigned short ip_id;
unsigned short ip_off;
unsigned char ip_ttl;
unsigned char ip_p;
unsigned short ip_sum;
unsigned long ip_src;
unsigned long ip_dst;
};
unsigned char sendpacket[PACKET_SIZE];
unsigned char recvpacket[PACKET_SIZE];
struct sockaddr_in dest_addr;
struct sockaddr_in from_addr;
int sockfd;
int pid;
unsigned short cal_chksum(unsigned short *addr,int len);
int pack(int pack_no);
int unpack(unsigned char *buf,int len);
void send_packet(void);
void recv_packet(void);
void main(int argc,char *argv[])
{
struct hostent *host;
struct protoent *protocol;
WSADATA wsaData;
int timeout=1000;
int SEND_COUNT=4;
int i;
char *par_host;
par_host=argv[argc-1]; //IP赋值
switch(argc)
{
case 2: break;
case 3: if(strcmp(argv[1],"-t")==0)
{
SEND_COUNT=10000;
break;
}
//fall through
default:
printf("usage: %s [-t] Host name or IP address\n",argv[0]);
exit(1);
}
if(WSAStartup(0x1010,&wsaData)!=0)
{
printf("wsastartup error\n");
exit(1);
}
if( (protocol=getprotobyname("icmp") )==NULL)
{
printf("getprotobyname error\n");
exit(1);
}
/*
printf("%s\n",protocol->p_name);
printf("%s\n",protocol->p_aliases);
printf("%d\n",protocol->p_proto);
system("pause");
*/
if( (sockfd=socket(AF_INET,SOCK_RAW,protocol->p_proto) )<0)
{
printf("socket error\n");
exit(1);
}
if(setsockopt(sockfd,SOL_SOCKET,SO_RCVTIMEO,(char*)&timeout,sizeof(timeout))h_length);
//resolve address to hostname
if(host=gethostbyaddr(host->h_addr,4,PF_INET))
par_host=host->h_name;
//
//printf("%s\n",par_host);
//
}
else if( dest_addr.sin_addr.s_addr=inet_addr(par_host)==INADDR_NONE)
{
printf("Unkown host %s\n",par_host);
exit(1);
}
pid=getpid();
/*
printf("%d\n",pid);
system("pause");
*/
printf("Pinging %s [%s]: with %d bytes of data:\n\n",par_host,inet_ntoa(dest_addr.sin_addr),SEND_SIZE);
for(i=0;i1)
{ sum+=*w++;
nleft-=2;
}
if( nleft==1)
{ *(unsigned char *)(&answer)=*(unsigned char *)w;
sum+=answer;
}
sum=(sum>>16)+(sum&0xffff);
sum+=(sum>>16);
answer=~sum;
return answer;
}
//打包
int pack(int pack_no)
{
int packsize;
struct icmp *icmp;
packsize=8+SEND_SIZE;
icmp=(struct icmp*)sendpacket;
icmp->icmp_type=ICMP_ECHO;
icmp->icmp_code=0;
icmp->icmp_cksum=0;
icmp->icmp_seq=pack_no;
icmp->icmp_id=pid;
icmp->icmp_data=GetTickCount();
icmp->icmp_cksum=cal_chksum( (unsigned short *)icmp,packsize); /*校验算法*/
return packsize;
}
//解包
int unpack(unsigned char *buf,int len)
{
struct ip *ip;
struct icmp *icmp;
double rtt;
int iphdrlen;
ip=(struct ip *)buf;
iphdrlen=ip->ip_hl*4;
icmp=(struct icmp *)(buf+iphdrlen);
if( (icmp->icmp_type==ICMP_ECHOREPLY) && (icmp->icmp_id==pid) )
{
len=len-iphdrlen-8;
rtt=GetTickCount()-icmp->icmp_data;
printf("Reply from %s: bytes=%d time=%.0fms TTL=%d icmp_seq=%u\n",
inet_ntoa(from_addr.sin_addr),
len,
rtt,
ip->ip_ttl,
icmp->icmp_seq);
return 1;
}
return 0;
}
//发送
void send_packet()
{
int packetsize;
static int pack_no=0;
packetsize=pack(pack_no++);
if( sendto(sockfd,(char *)sendpacket,packetsize,0,(struct sockaddr *)&dest_addr,sizeof(dest_addr) )=0)
success=unpack(recvpacket,n);
else if (WSAGetLastError() == WSAETIMEDOUT)
{
printf("Request timed out.\n");
return;
}
}while(!success);
}
UID5380 帖子239 精华0 积分1289 阅读权限40 来自软件学院 在线时间81 小时 注册时间2006-5-22 最后登录2007-2-24 查看详细资料
TOP
Platform: |
Size: 5881 |
Author: shuiyuan313 |
Hits:
Description: #pragma用法大全
Platform: |
Size: 59904 |
Author: slam99@sina.com |
Hits:
Description: 网上收集的常用pragma指令的用法,对于使用其他c++库很值得学习-Online collection of common usage of pragma directives for the use of other c++ Library is worth learning
Platform: |
Size: 23552 |
Author: zhangfaguang |
Hits:
Description: Pragma的一些应用,讲解的还算细致,请参考-Pragma
Platform: |
Size: 8192 |
Author: cliff |
Hits:
Description: 这是一篇详细介绍宏代码pragma的使用方法,对初学者有很好的指导作用。-This is a good paper to introduce how to use pragma function, it can give freshmen helpful direction.
Platform: |
Size: 12288 |
Author: kevin |
Hits:
Description: 关于pragma pack的用法(一)
一个很重要的参数
#pragma pack(n)
数据边界对齐方式:
以如下结构为例: struct {
char a
WORD b
DWORD c
char d
}
在Windows默认结构大小: sizeof(struct) = 4+4+4+4=16
与#pragma pack(4)一样
若设为 #pragma pack(1), 则结构大小: sizeof(struct) = 1+2+4+1=8
若设为 #pragma pack(2), 则结构大小: sizeof(struct) = 2+2+4+2=10
在#pragma pack(1)时:空间是节省了,但访问速度降低了 -About Useage of pragma pack
#pragma pack(n) is a important pram
It will align the data border of struct type.
Platform: |
Size: 1024 |
Author: xj |
Hits:
Description: pragma DATA_SECTION description document
Platform: |
Size: 791552 |
Author: SG |
Hits:
Description: STM8S207中断系统##pragma 0x原因.pdf,介绍中断的(STM8S207 interrupt system ##pragma 0x reason.Pdf, introducing interrupt)
Platform: |
Size: 854016 |
Author: 许生 |
Hits: