﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-winter729</title><link>http://www.cppblog.com/winter729/</link><description /><language>zh-cn</language><lastBuildDate>Fri, 03 Apr 2026 23:26:08 GMT</lastBuildDate><pubDate>Fri, 03 Apr 2026 23:26:08 GMT</pubDate><ttl>60</ttl><item><title>CCSprite 改变图片的方法</title><link>http://www.cppblog.com/winter729/archive/2013/03/18/198527.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Mon, 18 Mar 2013 02:36:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2013/03/18/198527.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/198527.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2013/03/18/198527.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/198527.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/198527.html</trackback:ping><description><![CDATA[<div><div style="color: #333333; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">在使用CCSpriteFrameCache 初始化的情况下更换sprite图片的方法。</div><div style="color: #333333; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">p.s : 如果使用spriteWithFile 则使用setTexture.<br /><div><pre style="margin-top: 0px; margin-bottom: 10px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; color: #000000; text-align: left; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; ">CCSpriteFrameCache* cache = [CCSpriteFrameCache sharedSpriteFrameCache]; CCSpriteFrame* frame = [cache spriteFrameByName:name]; [sprite setDisplayFrame:frame];</code></pre></div><br /><br /></div></div><img src ="http://www.cppblog.com/winter729/aggbug/198527.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2013-03-18 10:36 <a href="http://www.cppblog.com/winter729/archive/2013/03/18/198527.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ubuntu下配置redmine</title><link>http://www.cppblog.com/winter729/archive/2011/01/19/138840.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Wed, 19 Jan 2011 02:55:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2011/01/19/138840.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/138840.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2011/01/19/138840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/138840.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/138840.html</trackback:ping><description><![CDATA[1,到 http://www.redmine.org 官网上下载最新的redmine。目前是1.1.0。将其解压至/opt/redmine 下<br>2,到 http://www.redmine.org/projects/redmine/wiki/RedmineInstall 查看需要的安装环境。<br>&nbsp;&nbsp; 一般需要rails 和rack <br>&nbsp; ：<code>gem install rails -v=2.3.5</code><br>&nbsp; ：<code>gem install rack -v=1.0.1</code><br>3,安装mysql 数据库 ：sudo apt-get install mysql-server
。<br>&nbsp;&nbsp; 安装好后 进入mysql进行配置： mysql -u root (以后有密码了需要 输入 mysql -u root -p 按回车，再输入密码)<br>&nbsp;&nbsp; mysql&gt;grant all privileges on *.* to root@localhost identified by '123456';&nbsp;
//先设置root密码<br>&nbsp;&nbsp; mysql&gt;create database redmine character set utf8；
//必须要设置编码为utf8否则redmine所有汉字会显示成？？<br>&nbsp;&nbsp; mysql&gt;create user redmine@localhost identified by '123456'; //建立一个新用户redmine ，密码是123456<span style="font-family: monospace;"><br></span>&nbsp;&nbsp; mysql&gt;grant all privileges on redmine.* to redmine@localhost;<br>&nbsp;&nbsp; 这样mysql就配置好了。<br>4, 进入/opt/redmine 找到刚才解压的文件夹redmine-1.1.0 ，进入 config 目录下 将database.example.yml 复制为database.yml <br>&nbsp;&nbsp;&nbsp; sudo cp database.example.yml database.yml<br>&nbsp;&nbsp;&nbsp; sudo gedit database.yml<br>&nbsp;&nbsp;&nbsp; 按照如下修改<br>&nbsp;&nbsp;&nbsp;&nbsp; production:<br>&nbsp;&nbsp;&nbsp;&nbsp; adapter: mysql<br>&nbsp;&nbsp;&nbsp;&nbsp; socket: /var/run/mysqld/mysqld.sock<br>&nbsp;&nbsp;&nbsp;&nbsp; database: redmine<br>&nbsp;&nbsp;&nbsp;&nbsp; host: localhost<br>&nbsp;&nbsp;&nbsp;&nbsp; username: redmine<br>&nbsp;&nbsp;&nbsp;&nbsp; password: '123456'<br>&nbsp;&nbsp; &nbsp; encoding: utf8<br>5, 进入 /opt/redmine/redmine-1.1.0&nbsp; <br>&nbsp;&nbsp;&nbsp; 将redmine数据库导入到mysql数据库中 : <br>&nbsp;&nbsp;&nbsp; sudo rake generate session_store<br>&nbsp;&nbsp;&nbsp; sudo rake db:migrate RAILS_ENV =production<br>&nbsp;&nbsp;&nbsp; 如果导入顺利，就可以启动redmine了：<br>&nbsp;&nbsp;&nbsp; sudo ruby script/server -e production&nbsp; <br>6,打开ie浏览器，输入 ： http://localhost:3000 进入redmine 。默认用户名和密码是admin。在配置里面可以设置每个用户的语言，改成中文即可。<br><br><br>      <img src ="http://www.cppblog.com/winter729/aggbug/138840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2011-01-19 10:55 <a href="http://www.cppblog.com/winter729/archive/2011/01/19/138840.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux 下 实现一个简单的通信程序</title><link>http://www.cppblog.com/winter729/archive/2010/12/29/137687.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Wed, 29 Dec 2010 09:02:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/12/29/137687.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/137687.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/12/29/137687.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/137687.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/137687.html</trackback:ping><description><![CDATA[用到了select，对select的了解更加深入了一些。<br>由于使用到了tcp链接，所以在发送的时候一定要关闭socket以使对端能收到EOF。<br><br>#include &lt;sys/types.h&gt;<br>#include &lt;ctype.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;stdarg.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;stdio.h&gt;<br>#include &lt;fcntl.h&gt;<br>#include &lt;sys/ioctl.h&gt;<br>#include &lt;errno.h&gt;<br>#include &lt;string.h&gt;<br>#include &lt;assert.h&gt;<br>#include &lt;pthread.h&gt;<br>#include &lt;sys/socket.h&gt;<br>#include &lt;netinet/in.h&gt;<br>#include &lt;netinet/ip.h&gt;<br>#include &lt;netinet/udp.h&gt;<br>#include &lt;netinet/tcp.h&gt;<br>#include &lt;arpa/inet.h&gt;<br>#include &lt;netdb.h&gt;<br>#include &lt;net/if.h&gt;<br>#include &lt;net/route.h&gt;<br>#include &lt;sys/stat.h&gt;<br>#include &lt;sys/epoll.h&gt;<br>#include &lt;sys/resource.h&gt;<br>#include &lt;sys/wait.h&gt;<br>#include &lt;dlfcn.h&gt;<br>#define LISTEN_PORT 25000<br>#define BUFFLEN 128<br>typedef struct Recv_Info<br>{<br>&nbsp;&nbsp;&nbsp; FILE * fconnectin;<br>&nbsp;&nbsp;&nbsp; char filepath[50];<br>}Recv_Info;<br>typedef struct Send_Info<br>{<br>&nbsp;&nbsp;&nbsp; char ip[50];<br>&nbsp;&nbsp;&nbsp; char filepath[50];<br>}Send_Info;<br><br>int listen_fd,connect_fd;<br>void handle_int ( int signo )<br>{<br>&nbsp;&nbsp;&nbsp; fprintf ( stderr, "Interrupt catched!!\n" );&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; exit(0);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>}<br>static void* recieve_file(void * arg)<br>{<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; Recv_Info *recv_info = (Recv_Info*)arg;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; FILE * p;<br>&nbsp;&nbsp;&nbsp; p=fopen(recv_info-&gt;filepath,"w+");<br>&nbsp;&nbsp;&nbsp; if(p==NULL)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stdout,"Fopen failed in recieve file! make sure your filepath is right!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; char buff[BUFFLEN];&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; int count=0;<br>&nbsp;&nbsp;&nbsp; int amount=0;<br>&nbsp;&nbsp;&nbsp; while(fgets(buff,BUFFLEN,recv_info-&gt;fconnectin)!=NULL)<br>&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; count=strlen(buff);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amount+=count;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fputs(buff,p);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fprintf(stdout,"Recieve %d Bytes !\n",amount);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fclose(p);<br>&nbsp;&nbsp;&nbsp; close(connect_fd);<br>&nbsp;&nbsp;&nbsp; <br>}<br>static void* send_file(void * arg)<br>{<br>&nbsp;&nbsp;&nbsp; Send_Info * send_info=(Send_Info *)arg;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; char buff[BUFFLEN];<br>&nbsp;&nbsp;&nbsp; int remote_fd;<br>&nbsp;&nbsp;&nbsp; int remote_len;<br>&nbsp;&nbsp;&nbsp; struct sockaddr_in remote;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; FILE * p;<br>&nbsp;&nbsp;&nbsp; p=fopen(send_info-&gt;filepath,"r+");<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if(p==NULL)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stdout,"fopen failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return NULL;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; remote_fd = socket(AF_INET, SOCK_STREAM, 0);<br>&nbsp;&nbsp;&nbsp; if (remote_fd == -1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "socket() apply failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return NULL;<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; memset(&amp;remote, 0, sizeof(remote));<br>&nbsp;&nbsp;&nbsp; remote.sin_family&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = AF_INET;<br>&nbsp;&nbsp;&nbsp; remote.sin_port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = htons(LISTEN_PORT);<br>&nbsp;&nbsp;&nbsp; remote.sin_addr.s_addr = inet_addr(send_info-&gt;ip);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; int count = 0;<br>&nbsp;&nbsp;&nbsp; int amount = 0;<br>&nbsp;&nbsp;&nbsp; if(connect(remote_fd,(sockaddr*)&amp;remote,sizeof(sockaddr_in))==0)<br>&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; send(remote_fd,"s",1,0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; while(fgets(buff,BUFFLEN,p)!=NULL)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; count=send(remote_fd,buff,strlen(buff),0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; amount+=count;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stdout,"Send %d Bytes !\n",amount);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr,"errno:%d",errno);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; fclose(p);<br>&nbsp;&nbsp;&nbsp; close(remote_fd);<br>}<br>int main(int argc, char *argv[])<br>{&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; //init socket<br>&nbsp;&nbsp;&nbsp; struct sockaddr_in local;<br>&nbsp;&nbsp;&nbsp; int remote_len;<br>&nbsp;&nbsp;&nbsp; struct sockaddr_in remote;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; int ret;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; pthread_t tid;<br>&nbsp;&nbsp;&nbsp; listen_fd = socket(AF_INET, SOCK_STREAM, 0);<br>&nbsp;&nbsp;&nbsp; if (listen_fd == -1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "socket() apply failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return NULL ;<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; memset(&amp;local, 0, sizeof(local));<br>&nbsp;&nbsp;&nbsp; local.sin_family&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = AF_INET;<br>&nbsp;&nbsp;&nbsp; local.sin_port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = htons(LISTEN_PORT);<br>&nbsp;&nbsp;&nbsp; local.sin_addr.s_addr = htonl(INADDR_ANY);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if (bind(listen_fd, (struct sockaddr *)&amp;local, sizeof(local)) == -1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "bind failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(listen_fd);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return NULL;<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if (listen(listen_fd, 5) == -1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "listen wrong!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(listen_fd);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; //init signal<br>&nbsp;&nbsp;&nbsp; struct sigaction act;<br>&nbsp;&nbsp;&nbsp; act.sa_handler = handle_int;<br>&nbsp;&nbsp;&nbsp; sigemptyset ( &amp;act.sa_mask );<br>&nbsp;&nbsp;&nbsp; act.sa_flags = 0;<br>&nbsp;&nbsp;&nbsp; sigaction ( SIGINT, &amp;act, NULL );<br>&nbsp;&nbsp;&nbsp; //////////////////<br>&nbsp;&nbsp;&nbsp; //message loop&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fprintf(stdout,"-Welcome to FeiGe! q to quit ,s filename ip to send ,p to input path-\n");&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; //init select<br>&nbsp;&nbsp;&nbsp; fd_set rfds;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; int retval;<br><br>&nbsp;&nbsp;&nbsp; FD_ZERO(&amp;rfds);<br>&nbsp;&nbsp;&nbsp; FD_SET(0, &amp;rfds);&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; FD_SET(listen_fd, &amp;rfds);&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; char buffstdin[100];<br>&nbsp;&nbsp;&nbsp; char * token;<br>&nbsp;&nbsp;&nbsp; FILE * fstdin;<br>&nbsp;&nbsp;&nbsp; Recv_Info recv_info; //used for recv thread<br>&nbsp;&nbsp;&nbsp; Send_Info send_info; //used for send thread<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; fstdin=fdopen(0,"r+");<br>&nbsp;&nbsp;&nbsp; while ((retval = select(4, &amp;rfds, NULL, NULL, NULL)) &gt; 0)//begin the select loop<br>&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(FD_ISSET(0,&amp;rfds))//stdin is ready<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fgets(buffstdin,100,fstdin);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //get input<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch(buffstdin[0])&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //check the first charactor<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'q':<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit(0);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 's':&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //s means send<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memset(&amp;send_info,0,sizeof(Send_Info));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; token = strtok(buffstdin," "); // s<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; token = strtok(NULL," "); // filename<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(send_info.filepath,token,strlen(token));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; token = strtok(NULL,"\n"); // ip<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(send_info.ip,token,strlen(token));&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((ret = pthread_create(&amp;tid, NULL, send_file, (void *)&amp;send_info)) != 0)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "pthread_create() failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(connect_fd);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 'p':&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //p means path<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; token = strtok(buffstdin," "); &nbsp;&nbsp;&nbsp; // get a p<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; token = strtok(NULL,"\n"); &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // get path&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memcpy(recv_info.filepath,token,strlen(token));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ((ret = pthread_create(&amp;tid, NULL, recieve_file, (void *)&amp;recv_info)) != 0)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "pthread_create() failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(connect_fd);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; default:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(FD_ISSET(listen_fd,&amp;rfds))//listen fd is ready<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; remote_len = sizeof(remote);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memset(&amp;remote, 0, sizeof(remote));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; connect_fd = accept(listen_fd, (struct sockaddr *)&amp;remote, (socklen_t *)&amp;remote_len);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (connect_fd == -1)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (errno == EINTR)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; continue;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stderr, "accept failed!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(listen_fd);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return -1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; memset(&amp;recv_info,0,sizeof(Recv_Info));&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; recv_info.fconnectin=fdopen(connect_fd,"r+");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(fgetc(recv_info.fconnectin)!='s')<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close(connect_fd);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stdout,"wrong format file incoming!\n");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fprintf(stdout,"A new file ,input a full path with p \n");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FD_ZERO(&amp;rfds);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FD_SET(0, &amp;rfds);&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FD_SET(listen_fd, &amp;rfds);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; return 0;<br>}<br><img src ="http://www.cppblog.com/winter729/aggbug/137687.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-12-29 17:02 <a href="http://www.cppblog.com/winter729/archive/2010/12/29/137687.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用statfs 函数计算磁盘剩余空间</title><link>http://www.cppblog.com/winter729/archive/2010/10/29/131749.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Fri, 29 Oct 2010 07:13:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/29/131749.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/131749.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/29/131749.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/131749.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/131749.html</trackback:ping><description><![CDATA[如果想在程序里查看磁盘空间，就要用到statfs()函数。<br><br>查看指定路径下硬盘总空间和剩余空间大小的方法：<br><br>&nbsp;&nbsp;&nbsp; struct statfs diskInfo;<br>&nbsp;&nbsp;&nbsp; statfs("/",&amp;diskInfo);<br>&nbsp;&nbsp;&nbsp; unsigned long long blocksize = diskInfo.f_bsize;// 每个block里面包含的字节数<br>&nbsp;&nbsp;&nbsp; unsigned long long totalsize = blocksize * diskInfo.f_blocks;//总的字节数<br>&nbsp;&nbsp;&nbsp; printf("TOTAL_SIZE == %lu MB\n",totalsize&gt;&gt;20); // 1024*1024 =1MB&nbsp; 换算成MB单位<br><br>&nbsp;&nbsp;&nbsp; unsigned long long freeDisk = diskInfo.f_bfree*blocksize; //再计算下剩余的空间大小<br>&nbsp;&nbsp;&nbsp; printf("DISK_FREE == %ld MB\n",freeDisk&gt;&gt;20);<br><br><img src ="http://www.cppblog.com/winter729/aggbug/131749.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-29 15:13 <a href="http://www.cppblog.com/winter729/archive/2010/10/29/131749.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下各种printf函数的使用经验</title><link>http://www.cppblog.com/winter729/archive/2010/10/29/131719.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Fri, 29 Oct 2010 02:51:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/29/131719.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/131719.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/29/131719.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/131719.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/131719.html</trackback:ping><description><![CDATA[char * p="wow";<br><br>最基本的&nbsp;&nbsp; ：<br><br>printf（&#8220;hello %s&#8221;，p）<br><br>可以定向的：<br><br>fprintf(stdout,&#8220;hello %s \n&#8221;，p)&nbsp; //行缓冲 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>fprintf(stderr,&#8220;hello %s&nbsp; \n&#8221;，p)&nbsp; //不缓冲<br><br>可以输出到buf里的：<br><br>char buf[100];<br><br>snprintf(buf,&#8220;hello %s&nbsp; \n&#8221;，p);<br><br>&nbsp;字符格式：<br><br>%s :字符串<br>%x：十六进制<br>0x%.2x ：按照类似0xFF的格式显示十六进制<br>%lu： long unsigned<br>%llu:&nbsp;&nbsp; long long unsigned<br><br> <img src ="http://www.cppblog.com/winter729/aggbug/131719.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-29 10:51 <a href="http://www.cppblog.com/winter729/archive/2010/10/29/131719.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Base64编解码函数</title><link>http://www.cppblog.com/winter729/archive/2010/10/29/131718.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Fri, 29 Oct 2010 02:37:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/29/131718.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/131718.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/29/131718.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/131718.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/131718.html</trackback:ping><description><![CDATA[#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;string.h&gt;<br>//decode <br>const char Base64IdxTab[128] =<br>{<br><br>&nbsp;&nbsp;&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,<br><br>&nbsp;&nbsp;&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,<br><br>&nbsp;&nbsp;&nbsp; 255,255,255,255,&nbsp; 255,255,255,255,&nbsp; 255,255,255,62,&nbsp;&nbsp; 255,255,255,63,<br><br>&nbsp;&nbsp;&nbsp; 52,53,54,55,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 56,57,58,59,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 60,61,255,255,&nbsp;&nbsp;&nbsp; 255,255,255,255,<br><br>&nbsp;&nbsp;&nbsp; 255,0,1,2,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3,4,5,6,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7,8,9,10,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11,12,13,14,<br><br>&nbsp;&nbsp;&nbsp; 15,16,17,18,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19,20,21,22,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 23,24,25,255,&nbsp;&nbsp;&nbsp;&nbsp; 255,255,255,255,<br><br>&nbsp;&nbsp;&nbsp; 255,26,27,28,&nbsp;&nbsp;&nbsp;&nbsp; 29,30,31,32,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 33,34,35,36,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 37,38,39,40,<br><br>&nbsp;&nbsp;&nbsp; 41,42,43,44,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 45,46,47,48,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 49,50,51,255,&nbsp;&nbsp;&nbsp;&nbsp; 255,255,255,255<br>};<br>#define BVal(x) Base64IdxTab[x]<br>int DecodeBase64(char * pInput, char * pOutput)<br>{<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int i = 0;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int iCnt = 0;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int iSrcLen = (int)strlen(pInput);<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char * p = pOutput;<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (i=0; i &lt; iSrcLen; i++)<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pInput[i] &gt; 127) continue;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pInput[i] == '=') return p-pOutput+1;<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a = BVal(pInput[i]);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (a == 255) continue;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; switch (iCnt)<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 0:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p = a &lt;&lt; 2;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iCnt++;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 1:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p++ |= a &gt;&gt; 4;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p = a &lt;&lt; 4;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iCnt++;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 2:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p++ |= a &gt;&gt; 2;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p = a &lt;&lt; 6;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iCnt++;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; case 3:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p++ |= a;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; iCnt = 0;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; break;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *p = 0x00;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return p-pOutput;<br>}<br>//encode<br>const char Base64ValTab[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";<br>#define AVal(x) Base64ValTab[x]<br>int EncodeBase64(char * pInput, char * pOutput)<br>{<br>&nbsp;&nbsp;&nbsp; int i = 0;<br>&nbsp;&nbsp;&nbsp; int loop = 0;<br>&nbsp;&nbsp;&nbsp; int remain = 0;<br>&nbsp;&nbsp;&nbsp; int iDstLen = 0;<br>&nbsp;&nbsp;&nbsp; int iSrcLen = (int)strlen(pInput);<br><br>&nbsp;&nbsp;&nbsp; loop = iSrcLen/3;<br>&nbsp;&nbsp;&nbsp; remain = iSrcLen%3;<br><br>&nbsp;&nbsp;&nbsp; // also can encode native char one by one as decode method<br>&nbsp;&nbsp;&nbsp; // but because all of char in native string&nbsp; is to be encoded so encode 3-chars one time is easier.<br><br>&nbsp;&nbsp;&nbsp; for (i=0; i &lt; loop; i++)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a1 = (pInput[i*3] &gt;&gt; 2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a2 = ( ((pInput[i*3] &amp; 0x03) &lt;&lt; 4) | (pInput[i*3+1] &gt;&gt; 4) );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a3 = ( ((pInput[i*3+1] &amp; 0x0F) &lt;&lt; 2) | ((pInput[i*3+2] &amp; 0xC0) &gt;&gt; 6) );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a4 = (pInput[i*3+2] &amp; 0x3F);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[i*4] = AVal(a1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[i*4+1] = AVal(a2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[i*4+2] = AVal(a3);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[i*4+3] = AVal(a4);<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; iDstLen = i*4;<br><br>&nbsp;&nbsp;&nbsp; if (remain == 1)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // should pad two equal sign<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; i = iSrcLen-1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a1 = (pInput[i] &gt;&gt; 2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a2 = ((pInput[i] &amp; 0x03) &lt;&lt; 4);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = AVal(a1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = AVal(a2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = '=';<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = '=';<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen] = 0x00;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else if (remain == 2)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // should pad one equal sign<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; i = iSrcLen-2;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a1 = (pInput[i] &gt;&gt; 2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a2 = ( ((pInput[i] &amp; 0x03) &lt;&lt; 4) | (pInput[i+1] &gt;&gt; 4));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char a3 = ( (pInput[i+1] &amp; 0x0F) &lt;&lt; 2);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = AVal(a1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = AVal(a2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = AVal(a3);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen++] = '=';<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen] = 0x00;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // just division by 3<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pOutput[iDstLen] = 0x00;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; return iDstLen;<br>}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><img src ="http://www.cppblog.com/winter729/aggbug/131718.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-29 10:37 <a href="http://www.cppblog.com/winter729/archive/2010/10/29/131718.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>win7 添加网络打印机［转贴］</title><link>http://www.cppblog.com/winter729/archive/2010/10/29/131717.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Fri, 29 Oct 2010 02:32:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/29/131717.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/131717.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/29/131717.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/131717.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/131717.html</trackback:ping><description><![CDATA[<p><font style="font-family: 黑体;">许多朋友开始使用Win7了，但是有个问题一直困扰着大家，就是如何添加网络中的打印机，我也曾经尝试过很多方法，比如：到HP网站下载64位的驱动等，都没有效果，今天终于解决了问题，在这里与大家分享：</font></p>
<p><br>
<img  src="http://blog.cfan.com.cn/attachments/2009/06/1148_200906091035341.jpg" alt="Win7如何添加网络打印机" title="Win7如何添加网络打印机" width="750" border="0"><br>
<br></p>
<p>&nbsp;<wbr></p>
<p><img  src="http://blog.cfan.com.cn/attachments/2009/06/1148_200906091035481.jpg" style="text-align: center; margin: 0px auto; display: block;" alt="Win7如何添加网络打印机" title="Win7如何添加网络打印机" border="0"><br>
<br>
<img  src="http://blog.cfan.com.cn/attachments/2009/06/1148_200906091035482.jpg" style="text-align: center; margin: 0px auto; display: block;" alt="Win7如何添加网络打印机" title="Win7如何添加网络打印机" border="0">
</p>
<br>
<br>
<font style="font-family: 黑体;">接下来会快速显示出打印机选择列表，在里面选择你的网络打印机型号，确定后你的网络打印机就装上了</font><img src ="http://www.cppblog.com/winter729/aggbug/131717.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-29 10:32 <a href="http://www.cppblog.com/winter729/archive/2010/10/29/131717.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>posix mqueue 使用注意事项</title><link>http://www.cppblog.com/winter729/archive/2010/10/21/130727.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Thu, 21 Oct 2010 03:31:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/21/130727.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/130727.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/21/130727.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/130727.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/130727.html</trackback:ping><description><![CDATA[1,头文件：<br>#include &lt;fcntl.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* For O_* constants */<br>#include &lt;sys/stat.h&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* For mode constants */<br>#include &lt;mqueue.h&gt;<br><br>2,mq_open 在指定 mqueue 的名字时，必须以 &#8221;/"  开头，并且名字中只能有一个 &#8220;/"<br><br>3,对mqueue的队列位置进行重定向 <br>&nbsp;&nbsp;&nbsp;&nbsp;   <strong>$ mkdir /dev/mqueue<br>
&nbsp;&nbsp;&nbsp; $ mount -t mqueue none /dev/mqueue</strong> <br>4,在编译时要加上 -lrt 选项。<br><br><br><br> <img src ="http://www.cppblog.com/winter729/aggbug/130727.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-21 11:31 <a href="http://www.cppblog.com/winter729/archive/2010/10/21/130727.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>文件IO和标准IO的对比</title><link>http://www.cppblog.com/winter729/archive/2010/10/18/130238.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Mon, 18 Oct 2010 02:27:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/10/18/130238.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/130238.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/10/18/130238.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/130238.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/130238.html</trackback:ping><description><![CDATA[<span style="font-weight: bold; color: #0010ff;">文件IO</span>使用文件描述符进行操作。<br>常用函数：<br>open ： 返回打开指定路径文件的描述符<br>read&nbsp; ： 读取描述符指定的文件的内容，没有缓冲<br>write ： 写描述符指定的文件，没有缓冲<br>lseek ：为打开的文件设置偏移值（SEEK_SET; SEEK_CUR ;SEEK_END）<br><br><span style="color: #0010ff; font-weight: bold;">标准IO</span>对流进行操作，即： FILE * <br>（FILE 是个结构体，里面包含了文件描述符和缓冲区的信息）<br>我们常用的stdin,stdout,stderr 类型都是FILE *<br>常用函数：<br>fopen :返回打开指定路径文件的标准IO流：即FILE*<br>fdopen:将指定的文件描述符与标准IO流相关联。<img src="http://www.cppblog.com/CuteSoft_Client/CuteEditor/images/emstar.gif" align="absmiddle" border="0"><br>setbuf: 设置IO流的缓冲大小，设置成NULL即没有缓冲<br>fgetc:&nbsp; 读一个char<br>fputc:&nbsp; 写一个char<br>fgets:&nbsp; 读一行<br>fputs:&nbsp; 写一行<br>fread: 读取指定个数的长度<br>fwrite: 写入指定个数的长度<br>fflush:强制冲洗一个流<br><br>   <img src ="http://www.cppblog.com/winter729/aggbug/130238.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-10-18 10:27 <a href="http://www.cppblog.com/winter729/archive/2010/10/18/130238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Win7+Ubuntu重裝Windows</title><link>http://www.cppblog.com/winter729/archive/2010/08/20/124102.html</link><dc:creator>午夜凉饭</dc:creator><author>午夜凉饭</author><pubDate>Fri, 20 Aug 2010 07:54:00 GMT</pubDate><guid>http://www.cppblog.com/winter729/archive/2010/08/20/124102.html</guid><wfw:comment>http://www.cppblog.com/winter729/comments/124102.html</wfw:comment><comments>http://www.cppblog.com/winter729/archive/2010/08/20/124102.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/winter729/comments/commentRss/124102.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/winter729/services/trackbacks/124102.html</trackback:ping><description><![CDATA[我的硬盤為串口即SATA（也就是識別為sda）執行：
<p>sudo dd if=/dev/sda of=/media/linux.lnx bs=512 count=1</p>
<p>如果你的硬盤為並口即IDE執行：</p>
<p>sudo dd if=/dev/hda of=/media/linux.lnx bs=512 count=1</p>
<p>然後到/media找到linux.lnx這個文件，這個文件就是linux的啟動文件，</p>
<p>然後將這個文件copy到你重裝後的Win的根目錄，一般是C盤.如果是xp这里修改啟動文件boot.ini在最後加入：</p>
<p>C:\linux.lnx=Ubuntu10.04 就行了。</p>
<p>但是win7已经取消了boot.ini,所以我们必须使用工具才行。下载EasyBCD,在界面添加linux 引导。但是这里没结束，因为path不对，</p>
<p>我们需要用管理员身份运行cmd ，然后到c:/Windows/System32下运行bcdedit,这里能找到刚才添加的linux的ID串，然后输入：</p>
<p>c:/Windows/System32/bcdedit /set {刚才添加的linux的ID串} path /linux.lnx<br></p>
<p>重啟就可以選擇進Ubuntu了，這個方法是比較簡單的方法了</p>
<img src ="http://www.cppblog.com/winter729/aggbug/124102.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/winter729/" target="_blank">午夜凉饭</a> 2010-08-20 15:54 <a href="http://www.cppblog.com/winter729/archive/2010/08/20/124102.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>