博客搬家了,新的博客地址 www.k-door.com
posted @ 2014-07-05 18:22 Stone xin 閱讀(203) | 評論 (0) | 編輯 收藏
博客搬家了,新的博客地址 www.k-door.com新的博客地址 www.k-door.com
posted @ 2014-07-05 18:22 Stone xin 閱讀(203) | 評論 (0) | 編輯 收藏 【原創(chuàng)】warning no newline at end of file 的解決辦法
摘要: 閱讀全文
posted @ 2013-06-27 13:44 Stone xin 閱讀(1159) | 評論 (0) | 編輯 收藏 【原創(chuàng)】正確使用map的erase方法【修正版】
在好多不負責任的博客中普及了一些錯誤的map刪除元素的方法。
現(xiàn)在給出糾正。 首先,map的erase方法有三種形式
第3種沒有什么歧義,不用細說了。 最有歧義的就是第一種和第二種。 有返回值的接口,是刪除key為參數(shù)的。返回值是刪除的數(shù)量。因為map中key不會重復,所以,如果key存在,則返回的是1,否則,返回是0; 如果是調用的iter接口,則刪除的是迭代器位置的元素。 如果只刪除一個元素,直接 map.erase(iter);就好了。 如果用循環(huán)。 while(iter!=map.end) { if(condition) { map.erase(iter++); }else{ ++iter; } } 官方手冊地址: http://www.cplusplus.com/reference/map/map/erase/ posted @ 2013-05-03 11:29 Stone xin 閱讀(2191) | 評論 (0) | 編輯 收藏 開源圖形庫 c語言-圖形圖像庫 集合[轉]
摘要: Google三維API O3D O3D 是一個開源的 Web API 用來在瀏覽器上創(chuàng)建界面豐富的交互式的 3D 應用程序。這是一種基于網(wǎng)頁的可控3D標準。此格式期望真正的基于瀏覽器,獨立于操作系統(tǒng)之外,并且支持主流的3D顯卡,這樣就可以在網(wǎng)頁中實現(xiàn)效果逼真的3D動畫。在線演示:http://o3... 更多O3D信息 最新新聞: 谷歌聯(lián)手Mozilla基金開發(fā)3D互聯(lián)網(wǎng)圖像技術發(fā)... 閱讀全文
posted @ 2013-02-18 15:28 Stone xin 閱讀(5285) | 評論 (0) | 編輯 收藏 實現(xiàn)簡單的POST數(shù)據(jù)【修正版】
摘要: 實現(xiàn)簡單的POST數(shù)據(jù)【修正版】 閱讀全文
posted @ 2012-12-12 17:46 Stone xin 閱讀(445) | 評論 (0) | 編輯 收藏 Chrome所涉及26個開源代碼
摘要: Chrome所涉及26個開源代碼 閱讀全文
posted @ 2012-11-20 21:48 Stone xin 閱讀(452) | 評論 (0) | 編輯 收藏 [轉載]windows路徑操作API函數(shù)
摘要: windows路徑操作API函數(shù) 閱讀全文
posted @ 2012-09-01 14:56 Stone xin 閱讀(5695) | 評論 (0) | 編輯 收藏 Windows程序增加控制臺#include "StdAfx.h"
#include "Console4GUI.h" Console4GUI::Console4GUI(void) { AllocConsole(); // Create a new console window int hCrun; hCrun = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT); FILE *file = _fdopen(hCrun, "w"); // use default stream buffer setvbuf(file, NULL, _IONBF, 0); *stdout = *file; std::cout<<"控制臺啟動"<<std::endl; } Console4GUI::~Console4GUI(void) { FreeConsole(); // Close the console window } #pragma once
#include <fcntl.h> #include <io.h> #include <iostream> class Console4GUI { public: Console4GUI(void); ~Console4GUI(void); }; posted @ 2012-05-17 16:58 Stone xin 閱讀(376) | 評論 (0) | 編輯 收藏 不定長參數(shù)格式化輸出(支持中文字符)#include <iostream>
如果要返回值:
#include <string> void myformat(const char *fmt, ){ va_list ap; va_start(ap, fmt); wchar_t buf[2048]; vswprintf(buf,fmt,ap); va_end(ap); std::wcout.imbue(std::locale("chs")); std::wcout<<buf<<std::endl; } #include <iostream>
#include <string> std::wstring myformat(const char *fmt, ){ va_list ap; va_start(ap, fmt); wchar_t buf[2048]; vswprintf(buf,fmt,ap); va_end(ap); std::wstring str = std::wstring(buf); return str; } posted @ 2012-05-17 16:52 Stone xin 閱讀(638) | 評論 (0) | 編輯 收藏 |
|||||||