随笔分类 -  c++

上一页 1 2 3 4 下一页
boost::asio::streambuf相关的操作方法
摘要:boost::asio::streambuf的定义如下:namespace boost {namespace asio {/// Typedef for the typical usage of basic_streambuf.typedef basic_streambuf<> streambuf;} // namespace asio} // namespace boost basic_streambuf继承于std::streambuf,如下: class basic_streambuf : public std::streambuf, private noncopyable 阅读全文
posted @ 2012-08-26 16:00 袁晓平 阅读(3200) 评论(0) 推荐(0)
应用boost库serialize标准库里的map
摘要:需求,最近做ios程序,需要将用户密码和帐号保存到本地磁盘,而用用户不止一个,想到boost库里的serialization比较适合,用户就用标准库里的map来保存,也就是std::map<std::string, std::string>,代码如下:UserInfo.h://// UserInfo.h// app1//// Created by xp y on 12-8-23.// Copyright (c) 2012年 xp y. All rights reserved.//#ifndef __app1__UserInfo__#define __app1__UserInfo__ 阅读全文
posted @ 2012-08-23 21:45 袁晓平 阅读(1693) 评论(0) 推荐(0)
给ubuntu12.04换3.4.6的内核
摘要:从kernel.org下载3.4.6版本的kernel源码,至/home/musictom/Downloads解压tar -xvfj linux-3.4.6.tar.bz2cd linux-3.4.6make menuconfig根据自己的需要进行配置后makesudo make installsudo make modules_installln -s /boot/vmlinuz-3.4.6 /vmlinuz-3.4.6mkinitramfs -o /boot/initrd.img-3.4.6 /lib/modules/3.4.6 ln -s /boot/initrd.img-3.4.6 / 阅读全文
posted @ 2012-07-29 21:52 袁晓平 阅读(224) 评论(0) 推荐(0)
this linker was not configured to use sysroots和C compiler cannot create executables的解决办法
摘要:this linker was not configured to use sysrootsC compiler cannot create executables在ubuntu下想编译linux kernel,键入命令make menuconfig时,报出this linker was not configured to use sysroots查了一下,是因为/usr/local/bin/ld在编译前没有被配置为configure --with-sysroot所以下载了binutils-2.22想编译一个带sysroot的键入命令 ../binutils-2.22/configure -- 阅读全文
posted @ 2012-07-28 23:52 袁晓平 阅读(2962) 评论(0) 推荐(0)
cygwin下gdb7.4编译
摘要:cd /home/musictommkdir gdb-7.4-i386-pc-cygwin-outcd gdb-7.4-i386-pc-cygwin-out../gdb-7.4/configure --with-gmp=/usr/local --with-mpc=/usr/local/ --with-mpfr=/usr/local/ --prefix=/usr/local/gcc-4.7.1-i386-pc-cygwin/ --with-build-libsubdir=/usr/local/lib/makemake install中途会遇到错误:configure: error: no ter 阅读全文
posted @ 2012-07-22 12:49 袁晓平 阅读(695) 评论(0) 推荐(0)
cygwin下的gcc-4.7.1编译心得
摘要:步骤:1、先编译gmp mpfr mpc这几个库,注意configure时--prefix=/usr/local/2、中间碰到过can not compute suffix的错误,在命令export LD_LIBRARY_PATH=/usr/local/:${LD_LIBRARY_PATH}export LD_RUN_PATH=/usr/local/:${LD_RUN_PATH}也不行,最后修改了/home/musictom/.bash_profile加上了如下行:PATH="/bin/:/lib/:/usr/sbin/:/usr/local/bin/:/usr/i686-pc-mi 阅读全文
posted @ 2012-07-21 23:03 袁晓平 阅读(1417) 评论(0) 推荐(0)
mpc-0.9编译方法
摘要:解压源代码至mpc-0.9mkdir mpc-0.9-outcd mpc-0.9-out../mpc-0.9/configure --prefix=/home/musictom/mpc-0.9-install --with-gmp=/home/musictom/gmp-5.0.5-install --with-mpfr=/home/musictom/mpfr-3.1.0-installmakemake install如果要让库在arm机器上能运行,要加上--host=arm-eabi选项 阅读全文
posted @ 2012-07-14 21:19 袁晓平 阅读(261) 评论(0) 推荐(0)
mpfr-3.1.0编译方法
摘要:解压源代码至mpfr-3.1.0mkdir mpfr-3.1.0-out../mpfr-3.1.0/configure --prefix=/home/musictom/mpfr-3.1.0-install --with-gmp=/home/musictom/gmp-5.0.5-installmakemake install 阅读全文
posted @ 2012-07-14 21:07 袁晓平 阅读(347) 评论(0) 推荐(0)
gmp-5.0.5编译
摘要:1、解压源代码至gmp-5.0.52、mkdir gmp-5.0.5-out3、cd gmp-5.0.5-outCPPFLAGS=-fexceptions ../gmp-5.0.5/configure--enable-cxx --prefix=/usr/localmakemake installmake check 阅读全文
posted @ 2012-07-14 20:55 袁晓平 阅读(431) 评论(0) 推荐(0)
binutils-2.22编译心得
摘要:最近想自己编译出arm的gcc,其中必须的一步是必须编译binutils,所以尝试了一下,步骤如下:1、安装cygwin,选择gcc及libiconv库,安装,不要用mingw的编译器编译,我查了下,好象mingw里是没有fcntl.h的,所以编时会报错的,可以用gcc -v查看编译器的信息2、解压binutils-2.223、mkdir binutils-2.22-arm-unknown-eabi-outcd binutils-2.22-arm-unknown-eabi-out../binutils-2.22/configure --prefix=/home/musictom/binutil 阅读全文
posted @ 2012-07-14 18:18 袁晓平 阅读(1391) 评论(0) 推荐(0)
poco之HttpRequest之post方法
摘要:#import <iostream>#import <Poco/Net/HTTPClientSession.h>#import <Poco/Net/HttpRequest.h>#import <Poco/Net/HttpResponse.h>#import <Poco/URI.h>#import <Poco/Net/HTTPCredentials.h>#import <Poco/StreamCopier.h>#import <Poco/Net/HTMLForm.h>#import <Poco/ 阅读全文
posted @ 2012-06-10 15:40 袁晓平 阅读(5311) 评论(0) 推荐(0)
poco之HttpRequest之get方法
摘要:Poco::Net::HTTPClientSession s("www.cnblogs.com"); 需要引用的头文件是:#import <Poco/Net/HTTPClientSession.h>#import <Poco/Net/HttpRequest.h>#import <Poco/Net/HttpResponse.h>#import <Poco/StreamCopier.h>#import <Poco/Net/HTMLForm.h>#import <Poco/BinaryReader.h>#im 阅读全文
posted @ 2012-06-08 17:00 袁晓平 阅读(2113) 评论(0) 推荐(0)
为iphone及iphone simulator编译qt库
摘要:获取qt库,打开terminal,键入cd /Users/test/Downloads回车,git clone git://gitorious.org/+qt-iphone/qt/qt-iphone-clone.git 等待片刻,在当前目录会有一个目录qt-iphone-clone,进入目录,打开ios.txt,里面模拟器及真机的编译方法按照方法,键入./configure -xplatform iphonesimulator-g++42 -platform macx-ios-g++42 -opensource -ios -no-accessibility -no-qt3support -no 阅读全文
posted @ 2012-06-01 13:43 袁晓平 阅读(748) 评论(0) 推荐(0)
为iphone及iphone simulator编译poco库
摘要:./configure --config=iPhone --prefix=/libs/pocos --static --notests --nosamples#./configure --config=iPhoneSimulator --prefix=/libs/pocos --static --notests --nosamples 由于系统升级到了mac os x 10.7.4,xcode目录也变到了/Applications/Xcode.app,所以要编译iphone版的就要做些修改,找到build/config/iPhone文件打开编辑,修改如下:IPHONE_SDK_VERSION 阅读全文
posted @ 2012-05-30 14:02 袁晓平 阅读(368) 评论(0) 推荐(0)
c++ builder调用htmlencode
摘要:先include httpapp.hpp再调用HTMLDecode(str)即可,还包括HTMLEncode(const System::UnicodeString AStr);extern PACKAGE System::AnsiString __fastcall HTTPDecode(const System::AnsiString AStr);extern PACKAGE System::AnsiString __fastcall HTTPEncode(const System::AnsiString AStr); 阅读全文
posted @ 2011-04-21 18:38 袁晓平 阅读(614) 评论(1) 推荐(0)
c++ builder 使用indy http调用webservice方法
摘要:TIdHTTP *http = new TIdHTTP(NULL); TStringList *formData = new TStringList(); try{ IdAntiFreeze1->OnlyWhenIdle = false; formData->Add("<?xml version=\"1.0\" encoding=\"utf-8\"?>\<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" x 阅读全文
posted @ 2011-04-16 20:03 袁晓平 阅读(1109) 评论(0) 推荐(0)
c++ builder 读写ini文件
摘要:#include <IniFiles.hpp>TIniFile *ini; ini = new TIniFile( ChangeFileExt( Application->ExeName, ".INI" ) ); Top = ini->ReadInteger( "Form", "Top", 100 ); Left = ini->ReadInteger( "Form", "Left", 100 ); Caption = ini->ReadString( &quo 阅读全文
posted @ 2011-04-14 13:50 袁晓平 阅读(615) 评论(0) 推荐(0)
C++ Builder编写WinForm Post数据至Web服务器并得到返回数据
摘要:需要用到Indy组件,这个安装了C++Builder就会有,有于服务端是asp.net编写的,有一个隐藏域__VIEWSTATE,所以要加上它,然后再看服务器端需要什么字段就用TStringList对象Add就可以了,具体代码如下:TIdHTTP *http = new TIdHTTP(NULL); TStringList *formData = new TStringList();try{IdAntiFreeze1->OnlyWhenIdle = false;formData->Add("act=get_print_content");formData-> 阅读全文
posted @ 2011-04-08 15:06 袁晓平 阅读(478) 评论(0) 推荐(0)
C++ Builder编写WinForm从Web服务器下载文件
摘要:UnicodeString templateSavePath = ChangeFileExt(ExtractFilePath(Application->ExeName),"tmp.doc");IdAntiFreeze1->OnlyWhenIdle = false;//设置使程序有反应.TMemoryStream *templateStream ;templateStream = new TMemoryStream() ;try {IdHTTP1->Get("http://localhost/shaj.synadmin/tmp.doc", 阅读全文
posted @ 2011-04-07 17:52 袁晓平 阅读(261) 评论(0) 推荐(0)
c++ builder 写WinForm上传文件至Web服务器
摘要:因为项目的需要,需要做一个WinForm上传文件到Web服务端,其中WinForm用C++Builder2010编写,Web服务出来端用C#编写,弄了好久终于可以了,代码如下:WinForm:UnicodeString templateSavePath = ChangeFileExt(ExtractFilePath(Application->ExeName),"tmp_1.doc");TIdMultiPartFormDataStream *stream = new TIdMultiPartFormDataStream();TIdHTTP *http = new TId 阅读全文
posted @ 2011-04-07 17:50 袁晓平 阅读(650) 评论(0) 推荐(0)

上一页 1 2 3 4 下一页