﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewbieCoder</title>
	<atom:link href="http://newbiecoder.0ginr.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://newbiecoder.0ginr.com/blog</link>
	<description>沿路旅程如歌褪变</description>
	<lastBuildDate>Fri, 04 May 2012 15:50:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>360终于要把木马做到硬件级了</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=479</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=479#comments</comments>
		<pubDate>Fri, 04 May 2012 15:50:15 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=479</guid>
		<description><![CDATA[刚才惊悉360要出手机了。 不知道是不是自带云艳照功能。 又或是周教主的欲望远不止此。]]></description>
			<content:encoded><![CDATA[<p>刚才惊悉360要出手机了。</p>
<p>不知道是不是自带云艳照功能。</p>
<p>又或是周教主的欲望远不止此。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=479</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>命令行修改IP</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=476</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=476#comments</comments>
		<pubDate>Mon, 30 Apr 2012 20:35:35 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=476</guid>
		<description><![CDATA[如题。回来以后系统出了BUG，GUI里面怎么改IP都不行，保存不了。 这时候可以用命令行来改。 netsh interface ipv4 set address “本地连接” static IP地址 子网掩码 网关IP]]></description>
			<content:encoded><![CDATA[<p>如题。回来以后系统出了BUG，GUI里面怎么改IP都不行，保存不了。</p>
<p>这时候可以用命令行来改。</p>
<p></p><pre><code>netsh interface ipv4 set address “本地连接” static IP地址 子网掩码 网关IP</code></pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=476</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>出来混，迟早是要还的</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=464</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=464#comments</comments>
		<pubDate>Tue, 17 Apr 2012 11:28:48 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=464</guid>
		<description><![CDATA[如题。 http://cnbeta.com/articles/183099.htm]]></description>
			<content:encoded><![CDATA[<p>如题。</p>
<p><a href="http://cnbeta.com/articles/183099.htm">http://cnbeta.com/articles/183099.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=464</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>所以我要说我鄙视网易</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=465</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=465#comments</comments>
		<pubDate>Sun, 15 Apr 2012 09:07:59 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=465</guid>
		<description><![CDATA[最近网易指责腾讯新闻客户端抄袭网易客户端，至于是腾讯抄袭了CNN，还是腾讯抄了网易，还是腾讯跟网易都抄了CNN，又或是其他什么的，这个我就不说了。 之所以写这篇日志，一方面是因为之前网易的一篇公关文：http://www.cnbeta.com/articles/182443.htm，这篇公关文中充斥着大量“无耻”、“不道德”的字眼。作为一篇公关文，我觉得这样是不合适的。 第二是网易最新出来的这篇（截至发日志）公关文：http://www.cnbeta.com/articles/182614.htm，里面那个配图很有炒冷饭的意思。如果在数年前那个大家各做各的，只有腾讯做大而全的年代，将之称为腾讯的山寨文化，也未尝不可，那么在现在还这么说的话，未免就是别有居心了。 举个简单的例子，既然腾讯微博抄袭了Twitter，那么网易新闻是不是也抄袭了CNN？ 另外，这篇新的公关文末尾还有这么一段话比较值得留意： 而此次网易应用中心不仅列出腾讯“抄袭”的应用专题，而且还在微博上发起“人人都是腾讯产品经理”的话题，并引发大量网友的讨论。不过目前，腾讯尚未对此做出进一步的回应。 这段话很有越俎代庖的意思——网易本不是腾讯的上级，为什么可以替腾讯找产品经理？另外，这还有煽动舆论的意思。综合这一点和之前充斥着“无耻”、“不道德”的那篇公关文，我甚至会怀疑网易背后有360指使——如今腾讯口碑日渐好转，而360日渐恶化，于是360找来网易半路杀出，再把腾讯拉下水——我承认我的这个思维已经有了360的风范（参考360被AppStore全线下架时360的公关文）。 相信网易也知道，有时间打口水仗没时间做产品的，最后都会输的——为什么迅雷不指责QQ旋风？ 综上，如题。]]></description>
			<content:encoded><![CDATA[<p>最近网易指责腾讯新闻客户端抄袭网易客户端，至于是腾讯抄袭了CNN，还是腾讯抄了网易，还是腾讯跟网易都抄了CNN，又或是其他什么的，这个我就不说了。</p>
<p>之所以写这篇日志，一方面是因为之前网易的一篇公关文：<a href="http://www.cnbeta.com/articles/182443.htm">http://www.cnbeta.com/articles/182443.htm</a>，这篇公关文中充斥着大量“无耻”、“不道德”的字眼。作为一篇公关文，我觉得这样是不合适的。</p>
<p>第二是网易最新出来的这篇（截至发日志）公关文：<a href="http://www.cnbeta.com/articles/182614.htm">http://www.cnbeta.com/articles/182614.htm</a>，里面那个配图很有炒冷饭的意思。如果在数年前那个大家各做各的，只有腾讯做大而全的年代，将之称为腾讯的山寨文化，也未尝不可，那么在现在还这么说的话，未免就是别有居心了。</p>
<p>举个简单的例子，既然腾讯微博抄袭了Twitter，那么网易新闻是不是也抄袭了CNN？</p>
<p>另外，这篇新的公关文末尾还有这么一段话比较值得留意：</p>
<blockquote><p>而此次网易应用中心不仅列出腾讯“抄袭”的应用专题，而且还在微博上发起“人人都是腾讯产品经理”的话题，并引发大量网友的讨论。不过目前，腾讯尚未对此做出进一步的回应。</p></blockquote>
<p>这段话很有越俎代庖的意思——网易本不是腾讯的上级，为什么可以替腾讯找产品经理？另外，这还有煽动舆论的意思。综合这一点和之前充斥着“无耻”、“不道德”的那篇公关文，我甚至会怀疑网易背后有360指使——如今腾讯口碑日渐好转，而360日渐恶化，于是360找来网易半路杀出，再把腾讯拉下水——我承认我的这个思维已经有了360的风范（参考360被AppStore全线下架时<a href="http://www.cnbeta.com/articles/171642.htm">360的公关文</a>）。</p>
<p>相信网易也知道，有时间打口水仗没时间做产品的，最后都会输的——为什么迅雷不指责QQ旋风？</p>
<p>综上，如题。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=465</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>忘掉我跟你恩怨，樱花开了几转</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=432</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=432#comments</comments>
		<pubDate>Thu, 12 Apr 2012 06:49:14 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=432</guid>
		<description><![CDATA[。。]]></description>
			<content:encoded><![CDATA[<p>。。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=432</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>从屏蔽360浏览器说起</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=446</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=446#comments</comments>
		<pubDate>Wed, 11 Apr 2012 04:30:33 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=446</guid>
		<description><![CDATA[今天又更新了一下以前的识别UA屏蔽360系浏览器，增加了几种屏蔽方式，感觉好像回到了好多年前各种找trick的日子，还记得那时候每当发现一个trick时候的激动，那个日子多么美好~ 扯远了，事情是这样的，本来写一段C语言风格的JS或者C语言风格的PHP（= =。。）对我来说……如果只是简单的if什么的，其实我还是能写的…… 于是我就被网上的同学们华丽丽的鄙视了。（嗯，我经常被鄙视……习惯了。。） 这儿说一下我之前的代码的问题。 之前的正则表达式的写法是……好吧，我忘了，好像是“/360([A-Za-z.])*/i”，为什么这么写……因为这是我从其他地方复制的。这个写法有个什么问题呢，就是括号里面是输出的，然后没有用到，这当然是很浪费的啦。 然后呢，一开始写的JS没有用“(function () {&#8230;}) ();”这样的代码，直接用的其中的“&#8230;”部分，这样有一个全局变量污染的问题。这个……真的不怪我啊亲……我不知道有这语法……不然我肯定会把它包起来的啊亲。 还有些什么……忘记了。 另外一开始那文章里面的转跳地址直接写的是http://newbiecoder.0ginr.com/360blocked/，我的空间提供商表示如果用的人多，我迟早流量超限，所以……我就给改了。]]></description>
			<content:encoded><![CDATA[<p>今天又更新了一下以前的<a href="http://newbiecoder.0ginr.com/blog/?p=340">识别UA屏蔽360系浏览器</a>，增加了几种屏蔽方式，感觉好像回到了好多年前各种找trick的日子，还记得那时候每当发现一个trick时候的激动，那个日子多么美好~</p>
<p>扯远了，事情是这样的，本来写一段C语言风格的JS或者C语言风格的PHP（= =。。）对我来说……如果只是简单的if什么的，其实我还是能写的……</p>
<p>于是我就被网上的同学们华丽丽的鄙视了。（嗯，我经常被鄙视……习惯了。。）</p>
<p>这儿说一下我之前的代码的问题。</p>
<ul>
<li>之前的正则表达式的写法是……好吧，我忘了，好像是“/360([A-Za-z.])*/i”，为什么这么写……因为这是我从其他地方复制的。这个写法有个什么问题呢，就是括号里面是输出的，然后没有用到，这当然是很浪费的啦。</li>
<li>然后呢，一开始写的JS没有用“(function () {&#8230;}) ();”这样的代码，直接用的其中的“&#8230;”部分，这样有一个全局变量污染的问题。这个……真的不怪我啊亲……我不知道有这语法……不然我肯定会把它包起来的啊亲。</li>
</ul>
<p>还有些什么……忘记了。</p>
<p>另外一开始那文章里面的转跳地址直接写的是<a href="http://newbiecoder.0ginr.com/360blocked/">http://newbiecoder.0ginr.com/360blocked/</a>，我的空间提供商表示如果用的人多，我迟早流量超限，所以……我就给改了。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=446</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5小时后去搞什么体能测试</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=428</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=428#comments</comments>
		<pubDate>Tue, 10 Apr 2012 19:27:25 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=428</guid>
		<description><![CDATA[熬夜真不是件什么好事。]]></description>
			<content:encoded><![CDATA[<p>熬夜真不是件什么好事。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=428</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>所以说还是UTF8王道</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=418</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=418#comments</comments>
		<pubDate>Mon, 09 Apr 2012 15:12:13 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=418</guid>
		<description><![CDATA[事情是这样的，今天学校ACM队某人搞了一个签到系统，然后说如果名为AB的同学第一个签到，整个签到表（文本文档）就都挂了。 当时的第一反应是那个联通问题（请Google“联通问题 utf8”），但是也没看到现场，然后琢磨着也可能是提交上去的form的编码有问题。（因为网页的编码用的是gb2312，以为可能浏览器提交了utf8的上去。） 但是后来搞签到系统那同学发了个截图，内容是“{日期} {机器号} {方框}”，但是本来的格式应该是“{姓名} {机器号} {日期}”的，也就是说整个一行都反过来了。所以就想到了UTF8里面的RLM，然后找了个可以改编码的文本编辑器，然后让它用GB2312去解释这个文本文档，然后就没问题了。 所以其实还是联通问题。 当然，如果一开始就全部使用utf8，那也就没这么多问题了。所以说嘛，还是UTF8王道。]]></description>
			<content:encoded><![CDATA[<p>事情是这样的，今天学校ACM队某人搞了一个签到系统，然后说如果名为AB的同学第一个签到，整个签到表（文本文档）就都挂了。</p>
<p>当时的第一反应是那个联通问题（请Google“联通问题 utf8”），但是也没看到现场，然后琢磨着也可能是提交上去的form的编码有问题。（因为网页的编码用的是gb2312，以为可能浏览器提交了utf8的上去。）</p>
<p>但是后来搞签到系统那同学发了个截图，内容是“{日期} {机器号} {方框}”，但是本来的格式应该是“{姓名} {机器号} {日期}”的，也就是说整个一行都反过来了。所以就想到了UTF8里面的RLM，然后找了个可以改编码的文本编辑器，然后让它用GB2312去解释这个文本文档，然后就没问题了。</p>
<p>所以其实还是联通问题。</p>
<p>当然，如果一开始就全部使用utf8，那也就没这么多问题了。所以说嘛，还是UTF8王道。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=418</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>延长Windows 7提示应用没有响应的等待时间</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=412</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=412#comments</comments>
		<pubDate>Sat, 07 Apr 2012 07:23:40 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=412</guid>
		<description><![CDATA[修改如下（如果没有就新建）REG_SZ值：HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout内容是一个整数，表示提示之前的等待时间（毫秒），默认（不存在这个项的时候）是5000。 另外，对于编程人员，可以使用API“DisableProcessWindowsGhosting”来禁止这个提示。 最后，使用“应用程序兼容工具箱”也可以针对单个程序来禁止这个提示，不过操作较为复杂：http://blogs.technet.com/b/askperf/archive/2010/09/10/de-ghosting-your-windows.aspx。]]></description>
			<content:encoded><![CDATA[<p>修改如下（如果没有就新建）<strong>REG_SZ</strong>值：</p><pre><code>HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout</code></pre><p>内容是一个整数，表示提示之前的等待时间（毫秒），默认（不存在这个项的时候）是5000。</p>
<p>另外，对于编程人员，可以使用API“<a href="http://msdn.microsoft.com/en-us/library/ms648415.aspx">DisableProcessWindowsGhosting</a>”来禁止这个提示。</p>
<p>最后，使用“应用程序兼容工具箱”也可以针对单个程序来禁止这个提示，不过操作较为复杂：<a href="http://blogs.technet.com/b/askperf/archive/2010/09/10/de-ghosting-your-windows.aspx">http://blogs.technet.com/b/askperf/archive/2010/09/10/de-ghosting-your-windows.aspx</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=412</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QQ对战平台本地好友编辑器</title>
		<link>http://newbiecoder.0ginr.com/blog/?p=413</link>
		<comments>http://newbiecoder.0ginr.com/blog/?p=413#comments</comments>
		<pubDate>Fri, 06 Apr 2012 15:05:56 +0000</pubDate>
		<dc:creator>NewbieCoder</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://newbiecoder.0ginr.com/blog/?p=413</guid>
		<description><![CDATA[QQ对战平台的本地好友信息储存在%QQBattleZone%\%UIN%\Friend.dat，格式比较简单，一开始是一个DWORD，看起来总是为0，后面是一堆FriendObject（参考代码中的定义）。 在平台上好象没有查找好友的功能，只能添加同一个房子的，所以就写了这么个代码来自由添加。 代码好像写的比较烂，比如说添加好友就该单独写一个函数，偷个懒，各位勉强看吧。 /* Description A simple tool to manage local friends in QQ game platform. Author NewbieCoder@0GiNr Revision None */ #include &#60;cstdio&#62; #include &#60;cstring&#62; #include &#60;iostream&#62; #include &#60;string&#62; #include &#60;vector&#62; #include &#60;iomanip&#62; #include &#60;fstream&#62; #include &#60;algorithm&#62; struct FriendObject { int uin; char nickName[20]; // // Except for a DWORD at the beginning, which may [...]]]></description>
			<content:encoded><![CDATA[<p>QQ对战平台的本地好友信息储存在%QQBattleZone%\%UIN%\Friend.dat，格式比较简单，一开始是一个DWORD，看起来总是为0，后面是一堆FriendObject（参考代码中的定义）。</p>
<p>在平台上好象没有查找好友的功能，只能添加同一个房子的，所以就写了这么个代码来自由添加。</p>
<p>代码好像写的比较烂，比如说添加好友就该单独写一个函数，偷个懒，各位勉强看吧。</p>
<p></p><pre><code>/*
    Description
        
        A simple tool to manage local friends in QQ game platform.
        
    Author
    
        NewbieCoder@0GiNr
    
    Revision
        
        None
        
*/

#include &lt;cstdio&gt;
#include &lt;cstring&gt;

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iomanip&gt;
#include &lt;fstream&gt;
#include &lt;algorithm&gt;

struct FriendObject {
    int uin;
    char nickName[20];
    
    //
    // Except for a DWORD at the beginning, which may be face icon?
    // All the remaining bytes seem to always be zero.
    //
    
    char unknown[36];
    
    explicit FriendObject() {
        memset(this, 0, sizeof(*this));
    }
};

std::vector&lt;FriendObject&gt; friends;

//
// Binary read.
//

template&lt;class type&gt; std::istream&amp; binaryRead(std::istream &amp;istreamObject, type &amp;object) {
    return istreamObject.read((char *)&amp;object, sizeof(object));
}

//
// Binary write.
//

template&lt;class type&gt; std::ostream&amp; binaryWrite(std::ostream &amp;ostreamObject, type object) {
    return ostreamObject.write((char *)&amp;object, sizeof(object));
}

//
// Load friends information from &#039;Friend.dat&#039;
//
// File structure:
//        DWORD unknow -- Always zero.
//        One or more FriendObject follows.
//

void loadFriends(std::istream &amp;istreamObject) {
    FriendObject friendObject;
    int temp;
    
    friends.clear();
    
    //
    // Always zero?
    //
    
    binaryRead(istreamObject, temp);
    
    //
    // Function binaryRead simplifies the work much.
    //
    
    while (binaryRead(istreamObject, friendObject)) {
        friends.push_back(friendObject);
    }
}

//
// List the friends information.
//

void dumpFriends() {
    for (FriendObject friendObject : friends) {
        std::cout &lt;&lt; std::setw(10) &lt;&lt; std::left &lt;&lt; friendObject.uin &lt;&lt; &quot; &quot; &lt;&lt;
            std::setw(25) &lt;&lt; std::left &lt;&lt; friendObject.nickName &lt;&lt; std::endl;
    }
}

//
// Write friends information back.
//

void saveFriends(std::ostream &amp;ostreamObject) {
    
    //
    // Always be zero.
    //
    
    binaryWrite(ostreamObject, (int)0);
    
    //
    // Write them back one by one.
    //
    
    for (FriendObject friendObject : friends) {
        binaryWrite(ostreamObject, friendObject);
    }
}

int main(int argc, char **argv) {
    std::string command;
    std::string fileName = &quot;Friend.dat&quot;;
    std::ifstream inputFileStream;
    std::ofstream outputFileStream;
    bool informationModified = false;
    
    //
    // TODO: Validate arguments.
    //
    
    command = argv[1];
    
    inputFileStream.open(fileName, std::ios::binary);
    if (!inputFileStream) {
        std::cerr &lt;&lt; &quot;Unable to open Friend.dat.&quot; &lt;&lt; std::endl;
        
        return -1;
    }
    
    loadFriends(inputFileStream);
    inputFileStream.close();
    
    if (command == &quot;-list&quot;) {
        dumpFriends();
    } else if (command == &quot;-add&quot;) {
        FriendObject friendObject;
        std::vector&lt;FriendObject&gt;::iterator friendPointer;
        
        //
        // Data should be write back.
        //
        
        informationModified = true;

        sscanf(argv[2], &quot;%d&quot;, &amp;friendObject.uin);
        strncpy(friendObject.nickName, argv[3], sizeof(friendObject.nickName));;
        
        //
        // Check if we have to add a new entry.
        //
        
        friendPointer = std::find_if(friends.begin(), friends.end(), 
            [friendObject] (FriendObject const &amp;current) -&gt; bool {
            return current.uin == friendObject.uin;
        });
        
        if (friendPointer == friends.end()) {
            friends.push_back(friendObject);
        } else {
            *friendPointer = friendObject;
        }
    } else if (command == &quot;-delete&quot;) {
        int uin;
        
        sscanf(argv[2], &quot;%d&quot;, &amp;uin);
        
        informationModified = true;
        
        //
        // Find the corresponding entry and remove it if one exists.
        //
        
        friends.erase(std::remove_if(friends.begin(), friends.end(), 
            [uin] (FriendObject const &amp;current) -&gt; bool {
            return current.uin == uin;
        }), friends.end());
    } else if (command == &quot;-clear&quot;) {
        informationModified = true;
        friends.clear();
    }
    
    //
    // Operation &#039;-add&#039; and &#039;-delete&#039; requires writting data back.
    //
    
    if (informationModified) {    
        outputFileStream.open(fileName, std::ios::binary | std::ios::trunc);
        if (!outputFileStream) {
            std::cerr &lt;&lt; &quot;Unable to write back to Friend.dat.&quot; &lt;&lt; std::endl;
            
            return -1;
        }
        
        saveFriends(outputFileStream);
        
        outputFileStream.close();
    }
}</code></pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://newbiecoder.0ginr.com/blog/?feed=rss2&#038;p=413</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

