`
daojin
  • 浏览: 678044 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论
文章列表
//Map.cpp #include <StdAfx.h>   terrain.cpp: // terrain.cpp : Defines the entry point for the application. // #include "StdAfx.h" #include "Map.h" #include "Console.h" #include "IO.H" #include <sstream> #include <iostream> #incl ...
  如果HWND为NULL,   表明向当前线程发送Quit消息。。   大概是为了多任务的需要,Windows接管了所有的资源,以便于进行统一处理。 其中最××的就是接管了输入,并推出了消息队列的概念。 Windows为每个线程(包括主、辅、UI线程)维护一个消息队列,我们再从线程所属的消息队列中读取消息。这个消息...   [in] Handle to the window whose window procedure is to receive the message. The following values have special meanings. HWND_B ...
  一句话:        只有const的定义前面才可以有extern;别的则可有可无。   两种想法:   1.如果想在头文件中定义const:          const  int a=10; 2.如果想在cpp文件中进行定义:         前面使用extern 将其扩大为全局变量。       头文件中写:         extern const int a;      在cpp文件中进行定义:         extern const int a=10;   这样的话,const变量的使用就和普通变量一样了,   3.只有const有这个“文 ...
#include "StdAfx.h" #include "IO.H" #include <locale> using std::wstringstream; wstringstream *pBuffer=new wstringstream(); bool MyWrite(std::wstring s) { static bool InitLocal=true; if(InitLocal){ std::locale loc("chs"); pBuffer->imbue(loc); ...
// ffffffff.cpp : Defines the entry point for the console application. // #include "StdAfx.h" #include "IO.H" #include <iostream> #include <sstream> #include <stdio.h> #include <locale> using namespace std; wstringstream *pBuffer=new wstringstream( ...
int main(int argc,char*argv[]) { string s; ostringstream os; istream is(os.rdbuf()); os<<"1000 "<<en; os<<"1000 "<<endl; os<<"1000 "<<endl; is>>s; cout<<s; }  上面没有输出,原因是用了一个is关联了一个os的缓冲区!!因此失败.....解决办法 ...
rdbuf来重定向流 在SF的的collect.cpp中的collect函数中,使用了rdbuf来将标准输出重定向到日志文件。 // 重定向日志输出 ofstream file((LOG_PATH + "collect/" + fileName + ".log").c_str()); streambuf* buffer = ...
int main(int argc,char*argv[]) { string s; stringstream ssm; //ssm.rdbuf(); //写到流的缓冲区,,但是并不刷新。 ssm<<"hello分隔符!"; //从流读,实际上是从缓冲区读。 //读完之后缓冲区数据没了。 cout<<(bool)(ssm>>s); //这句话如果没有,那么将导致如下情况: //如果缓冲区在输出没有刷新的情况下被读取了。。 //那么将会视为错误。 //当前缓冲区被 ...
// dffffffff.cpp : Defines the entry point for the console application.//#include <StdAfx.h>#include   <iostream> #include   <locale> #include   <fstream>#include <string> #include <sstream>using namespace std;//创建全局对象。这些对象保存在全局区。 ofstream *pof=new ofstream(" ...
上篇文章讲述了如何创建自己的标准输入输出,但是如何将标准的输入输出流进行重定向呢:   下面是一个具体的方法:   fp = _fdopen( hConHandle, "w" );    *stdout = *fp; setvbuf( stdout, NULL, _IONBF, 0 );   我们可以完全仿照它的方法来做。   stdout stdin   的指向。。重新赋值就可以了:   *stdout=ostream(ofs.rdbuf());   完毕。。代码附上:      
// open and close a file using buffer members #include <fstream> using namespace std; int main () { char ch; fstream filestr; filebuf *pbuf; pbuf=filestr.rdbuf(); pbuf->open ("test.txt", fstream::in | fstream::out); // >> i/o operations here ...
wprintf 和 wcout 这篇文章应该是[netsin]的成果,我勤快,记下来。注:wprintf是C的标准库函数,但wcout不是C++的标准成员,C++中的 L"……" 是宽字符,却未必是unicode字符,这与编译器实现相关。[乾坤一笑]说:为什么 C/C++ 语 ...
#include <iostream.h> #include <stdio.h> class A{ private: int i; public: //int i; f(){ cout<<i<<endl; } }; class B:public A { }; class C:B{}; int main(){ C c; c.f(); }   看下面的代码 : #include <iostream.h> #include <stdio.h> class A{ priva ...
  主要是想写一个类似控制台的东西,可以监视我程序里面的动作。。。   直接用控制台也行,但是那样太刻板!没创意。。。我想给用户以提示,告诉他程序在干什么!!!!!!非常良好的界面。。。。。。   先写一些想法,然后再去弄: 1.接口: 只有一个那就是print(string str);为简单期间,就这样了; 2.行为的载体: 暂时选,一个Windows窗口吧,当然也可以是文件。 模式选择: 作为一个窗口,应该使用监听者模式,也就是他应该去监听Print事件,一个事件其实就是 一个函数调用。 窗口作为一个监听者而存在。 真的么???????????有一个更加抽象的东西存在,那就 ...
L1 = max(abs(vertx - viewx), abs(verty - viewy), abs(vertz -     viewz)); enabled = error * Threshold < L1;   第一个公式说的是距离,一个点的空间位置。 第二个公式说的是对于这个空间位置,如果error很大,超越了忍受程度,那么,就需要被enable 的。 第三个问题是什么时候该分解:   bc[x,y,z] == coordinates of box centerex[x,y,z] == extent of box from the center (i.e. 1/2 ...
Global site tag (gtag.js) - Google Analytics