文章分类 -  VC++ API

VC++ 函数
摘要:#include "StdAfx.h"#include <boost/regex.hpp>#include <string>#include <iostream>using namespace std;using namespace boost;int main(int argc, char* argv[]){string str = "2013hello";regex reg("(\\d+)(\\w+)"); //C++嘛,\ 表示转义符,所以要这样写\\;cmatch m;cmatch::ite 阅读全文
posted @ 2013-02-18 14:02 stma 阅读(114) 评论(0) 推荐(0)
摘要:01.#include <iostream>02.#include <boost/regex.hpp>03. 04.using namespace std;05.int main(int argc, char* argv[])06.{ //( 1 ) (( 3 ) 2 )(( 5 )4)( 6 ) 07. //(/w+)://((/w+/.)*/w+)((//w*)*)(//w+/./w+)?08. //^协议://网址(x.x...x)/路径(n个/字串)/网页文件(xxx.xxx)09. const char *szReg = "(//w... 阅读全文
posted @ 2013-02-18 13:52 stma 阅读(410) 评论(0) 推荐(0)
摘要:要使用Boost有两种方法,这是我认为最简单的一种,也是最详细的。1.到http://www.boost.org/users/history/下载安装包,这里下载的是Version 1.38.0,高版本的在我这里编译不成功~~~~2.将VC安装路径C:\Program Files\Microsoft Visual Studio\VC98\Bin\下的VCVARS32.BAT复制一份到D:\Program Files\boost_1_38_0\boost_1_38_0\libs\regex\build\3.进入cmd并运行:>>VCVARS32.BAT //这时屏幕显示 Settin 阅读全文
posted @ 2013-02-18 12:02 stma 阅读(335) 评论(0) 推荐(1)
摘要:入职培训第二个任务中做的应用识别,应该是比较简单化得那种识别,其中要使用到正则表达式,主要用来匹配包中的特征字段。之前找了网上一些安装方法不知道总是有些小毛病,于是综合了网上很多人的方法,做了蛮多尝试,记录下来让其他一些像我这种入门的也能快速的安装。不要让安装配置环境这种鸟事耽误了项目的进度。 【1】 首先获取库,这个可以到官方网站上下载,(boost.sourceforge.net)我们是公司提供的库(boost_1_34_0.zip),boost库最好选择比较老的版本,比如 1_34_0/1,比较新的版本好像有点问题,我家里的电脑是VS08,安装非常方便。 【2】 下载后解压到一个目录.. 阅读全文
posted @ 2013-02-18 11:47 stma 阅读(201) 评论(0) 推荐(0)
摘要:经常碰到字符串分割的问题,这里总结下,也方便我以后使用。一、用strtok函数进行字符串分割原型: char *strtok(char *str, const char *delim);功能:分解字符串为一组字符串。参数说明:str为要分解的字符串,delim为分隔符字符串。返回值:从str开头开始的一个个被分割的串。当没有被分割的串时则返回NULL。示例: 1 //借助strtok实现split 2 #include <string.h> 3 #include <stdio.h> 4 5 int main() 6 { 7 char s[] = "Golden 阅读全文
posted @ 2013-02-18 11:24 stma 阅读(2644) 评论(0) 推荐(0)
摘要:VC++2010已经支持regex了, 可以用来编译下述代码.01.#include <string> 02.#include <regex> 03.#include <iostream> 04.using namespace std; 05. 06./* 测试C++11中的正则表达式. */ 07.int main() 08.{ 09. //定义正则表达式,匹配时间格式 10. regex testRegex("[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}"); 11. 12. //要匹配的字符串 13. 阅读全文
posted @ 2013-02-17 19:48 stma 阅读(1106) 评论(0) 推荐(0)
摘要:gnuregex,PCRE,greta,boost,CAtlReg其中 CAtlReg 和greta 是微软的,不过 greta 据说已经多年不维护,不能在最新的编译器中编译.--------------------------------------------------不过我看 PCRE 也是 2007 年的呀. http://gnuwin32.sourceforge.net/packages/pcre.htm哦,应该从 http://www.pcre.org/ 进去,那个确实是版本未最新的.据说 "pcre就是公认最牛的C语言的正则表达式库,Python、Perl等语言都是用 阅读全文
posted @ 2013-02-17 19:36 stma 阅读(417) 评论(0) 推荐(0)
摘要:// C++ 正则表达式库 c++ boost.regex 都是使用*.hpp在查阅ASN-GW工程文件源代码的时候,发现了*.hpp文件,很奇怪,以前在教科书都没有学习过,在baidu一下,发现了一下要点:1、是Header Plus Plus 的简写。2、与*.h类似,hpp是C++程序头文件 。3、是VCL专用的头文件,已预编译。4、是一般模板类的头文件。5、一般来说,*.h里面只有声明,没有实现,而*.hpp里声明实现都有,后者可以减少.cpp的数量。6、*.h里面可以有using namespace std,而*.hpp里则无。7、*.hpp要注意的问题有: a)不可包含全局... 阅读全文
posted @ 2013-02-17 19:20 stma 阅读(1238) 评论(0) 推荐(0)
摘要:#include<iostream.h>#include<string.h>class CScore{private:int ID;char Name[8];int Math;int Phi;int Total;public:void Input(int,char*,int,int);void Sum();void Show();};void CScore::Input(int id,char* name,int math,int phi){ID=id;strcpy(Name,name);Math=math;Phi=phi;}void CScore::Sum(){Tot 阅读全文
posted @ 2013-02-17 15:26 stma 阅读(585) 评论(0) 推荐(0)
摘要:C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助。Const 是C++中常用的类型修饰符,常类型是指使用类型修饰符const说明的类型,常类型的变量或对象的值是不能被更新的。详细:http://blog.csdn.net/Eric_Jo/article/details/4138548以上这篇文章,告诉你C++是如何复杂得很 -_-! 阅读全文
posted @ 2013-02-17 15:04 stma 阅读(109) 评论(0) 推荐(0)
摘要:c++中的类除了具有封装的意味外,还有一点就是要使得定义的类可以像内置的类型(如int等)一样容易让人理解。例子:#include <stdio.h>class A{ // 定义一个类Apublic: A(int a) : n(a){} // 类A的构造函数,参数为一个int型变量a /*知识点:为什么可以这么写呢?看下面的网址,有追问。*/private: int n; //类的成员变量};main(){ A a(3); // 定义一个类A的对象a,使用3去初始化a,即调用A(3)来初始化a.n int b(3); // 与内置类型一样,定义一个int变量b,使用3去初始化,只不 阅读全文
posted @ 2013-02-17 14:31 stma 阅读(2374) 评论(0) 推荐(0)
摘要:我刚定义一个类public:int info;Node *next;Node(int number,Node *ptr = 0);};Node::Node(int number,Node *ptr = 0){info = number;next = ptr;}出现了这个错误1.cpp:11: error: default argument given for parameter 2 of ‘Node::Node(int, Node*)’1.cpp:8: error: after previous specification in ‘Node::Node(int, Node*)’但是通过内联函数 阅读全文
posted @ 2013-02-17 14:25 stma 阅读(320) 评论(0) 推荐(0)
摘要:我的一个控制台程序要用到CInternetSession来去网站信息。发现有问题。我比如我这样写:#include<afxinet.h>//想使用CInternetSession#include<afx.h>//想使用CStringvoidmain(){CInternetSessionSession(NULL,0);//这句出错,程序崩溃CHttpFile*myHttpFile=NULL;CStringm_SiteName="http://www.baidu.com";//此处省略无关代码myHttpFile->Close();Session. 阅读全文
posted @ 2013-02-17 11:32 stma 阅读(310) 评论(0) 推荐(0)
摘要:unresolved external symbol __endthreadex错误解决在用VC6.0写程序调试时,初学者总是会遇到一些错误,针对如下错误主要是因为MFC类库没有引用所出现的问题。错误现象:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexnafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadexDebug/jnHid.exe : fatal error 阅读全文
posted @ 2013-02-17 11:16 stma 阅读(303) 评论(0) 推荐(0)
摘要:宏定义:#define STRING "abcdefg \ "dfsdgdfhfdh"如果字符序列超过一行,可以在该行末尾用一反斜杠续行。例如:CString ss;ss = “this is a very long ” \ “string that is used as an example”;//末尾用一反斜杠续行这样用MessageBox来显示的时候是一行完整的语句,中间的间隔也没有问题。但是如果写成ss = “this is a very long \ string that is used as an example”;//末尾用一反斜杠续行这样显示出来 阅读全文
posted @ 2013-02-17 10:40 stma 阅读(7939) 评论(0) 推荐(0)
摘要:/**************************************************************************** Copyright (C) 2009 by DDD ** dedodong@163.com ** ****************************************************************************/#include"s... 阅读全文
posted @ 2013-02-15 13:15 stma 阅读(1997) 评论(0) 推荐(0)
摘要:使用 WinInet API 可以建立安全套接字层 (SSL) 或专用通信技术 (PCT) HTTP 会话。安全 HTTP(表示为 HTTPS://)在 TCP 端口 443 上发生。可以使用类似于下面这样的代码来建立 HTTPS 会话:[cpp] view plaincopyprint?//... hOpen=InternetOpen(...);Connect=InternetConnect(hOpen,//InternetOpenhandle "MyHttpServer",//Servername INTERNET_DEFAULT_HTTPS_PORT,//Defaul 阅读全文
posted @ 2013-02-15 13:11 stma 阅读(6812) 评论(0) 推荐(0)
摘要:How To Make SSL Requests Using WinInetIt is possible to establish a Secure Socket Layer (SSL) or Private Communications Technology (PCT) HTTP session with the WinInet APIs. Secure HTTP, denoted as HTTPS://, takes place over TCP port 443. Code similar to the following can be used to establish an HTTP 阅读全文
posted @ 2013-02-15 13:03 stma 阅读(909) 评论(0) 推荐(0)
摘要:用CHttpFile实现简单的GET/POST数据用CInternetSession实现HTTP POST登录 阅读全文
posted @ 2013-02-15 12:15 stma 阅读(206) 评论(0) 推荐(0)
摘要:在VC 6中可以将一个编辑框的"Styles"中的"Multiline“和”Auto VScroll“勾上,然后编辑框里面的内容即可自动换行。 另外,CEdit 类的消息: #include <afxwin.h> // 头文件详细:http://www.cnblogs.com/ziwuge/archive/2011/12/03/2274886.htmlMFC中CEdit控件的换行输入 - 罗索实验室 阅读全文
posted @ 2013-02-14 12:30 stma 阅读(279) 评论(0) 推荐(0)