CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  新手乐园

帮忙翻译一段代码

楼主yuchen2006(雨晨)2006-03-04 15:57:04 在 C/C++ / 新手乐园 提问

/***  
  *ostream.h   -   definitions/declarations   for   the   ostream   class  
  *  
  *               Copyright   (c)   1991-1997,   Microsoft   Corporation.     All   rights   reserved.  
  *  
  *Purpose:  
  *               This   file   defines   the   classes,   values,   macros,   and   functions  
  *               used   by   the   ostream   class.  
  *               [AT&T   C++]  
  *  
  *               [Public]  
  *  
  ****/  
   
  #if           _MSC_VER   >   1000  
  #pragma   once  
  #endif  
   
  #ifdef     __cplusplus  
   
  #ifndef   _INC_OSTREAM  
  #define   _INC_OSTREAM  
   
  #if           !defined(_WIN32)   &&   !defined(_MAC)  
  #error   ERROR:   Only   Mac   or   Win32   targets   supported!  
  #endif  
   
   
  #ifdef     _MSC_VER  
  //   Currently,   all   MS   C   compilers   for   Win32   platforms   default   to   8   byte  
  //   alignment.  
  #pragma   pack(push,8)  
   
  #include   <useoldio.h>  
   
  #endif     //   _MSC_VER  
   
  /*   Define   _CRTIMP   */  
   
  #ifndef   _CRTIMP  
  #ifdef     _DLL  
  #define   _CRTIMP   __declspec(dllimport)  
  #else       /*   ndef   _DLL   */  
  #define   _CRTIMP  
  #endif     /*   _DLL   */  
  #endif     /*   _CRTIMP   */  
   
   
  #include   <ios.h>  
   
  #ifdef     _MSC_VER  
  //   C4514:   "unreferenced   inline   function   has   been   removed"  
  #pragma   warning(disable:4514)   //   disable   C4514   warning  
  //   #pragma   warning(default:4514)                 //   use   this   to   reenable,   if   desired  
  #endif     //   _MSC_VER  
   
  typedef   long   streamoff,   streampos;  
   
  class   _CRTIMP   ostream   :   virtual   public   ios   {  
   
  public:  
                  ostream(streambuf*);  
                  virtual   ~ostream();  
   
                  ostream&   flush();  
                  int     opfx();  
                  void   osfx();  
   
  inline     ostream&   operator<<(ostream&   (__cdecl   *   _f)(ostream&));  
  inline     ostream&   operator<<(ios&   (__cdecl   *   _f)(ios&));  
                  ostream&   operator<<(const   char   *);  
  inline     ostream&   operator<<(const   unsigned   char   *);  
  inline     ostream&   operator<<(const   signed   char   *);  
  inline     ostream&   operator<<(char);  
                  ostream&   operator<<(unsigned   char);  
  inline     ostream&   operator<<(signed   char);  
                  ostream&   operator<<(short);  
                  ostream&   operator<<(unsigned   short);  
                  ostream&   operator<<(int);  
                  ostream&   operator<<(unsigned   int);  
                  ostream&   operator<<(long);  
                  ostream&   operator<<(unsigned   long);  
  inline     ostream&   operator<<(float);  
                  ostream&   operator<<(double);  
                  ostream&   operator<<(long   double);  
                  ostream&   operator<<(const   void   *);  
                  ostream&   operator<<(streambuf*);  
  inline     ostream&   put(char);  
                  ostream&   put(unsigned   char);  
  inline     ostream&   put(signed   char);  
                  ostream&   write(const   char   *,int);  
  inline     ostream&   write(const   unsigned   char   *,int);  
  inline     ostream&   write(const   signed   char   *,int);  
                  ostream&   seekp(streampos);  
                  ostream&   seekp(streamoff,ios::seek_dir);  
                  streampos   tellp();  
   
  protected:  
                  ostream();  
                  ostream(const   ostream&);                 //   treat   as   private  
                  ostream&   operator=(streambuf*);   //   treat   as   private  
                  ostream&   operator=(const   ostream&   _os)   {return   operator=(_os.rdbuf());   }  
                  int   do_opfx(int);                               //   not   used  
                  void   do_osfx();                                   //   not   used  
   
  private:  
                  ostream(ios&);  
                  ostream&   writepad(const   char   *,   const   char   *);  
                  int   x_floatused;  
  };  
   
  inline   ostream&   ostream::operator<<(ostream&   (__cdecl   *   _f)(ostream&))   {   (*_f)(*this);   return   *this;   }  
  inline   ostream&   ostream::operator<<(ios&   (__cdecl   *   _f)(ios&   ))   {   (*_f)(*this);   return   *this;   }  
   
  inline     ostream&   ostream::operator<<(char   _c)   {   return   operator<<((unsigned   char)   _c);   }  
  inline     ostream&   ostream::operator<<(signed   char   _c)   {   return   operator<<((unsigned   char)   _c);   }  
   
  inline     ostream&   ostream::operator<<(const   unsigned   char   *   _s)   {   return   operator<<((const   char   *)   _s);   }  
  inline     ostream&   ostream::operator<<(const   signed   char   *   _s)   {   return   operator<<((const   char   *)   _s);   }  
   
  inline     ostream&   ostream::operator<<(float   _f)   {   x_floatused   =   1;   return   operator<<((double)   _f);   }  
   
  inline     ostream&   ostream::put(char   _c)   {   return   put((unsigned   char)   _c);   }  
  inline     ostream&   ostream::put(signed   char   _c)   {   return   put((unsigned   char)   _c);   }  
   
  inline     ostream&   ostream::write(const   unsigned   char   *   _s,   int   _n)   {   return   write((char   *)   _s,   _n);   }  
  inline     ostream&   ostream::write(const   signed   char   *   _s,   int   _n)   {   return   write((char   *)   _s,   _n);   }  
   
   
  class   _CRTIMP   ostream_withassign   :   public   ostream   {  
                  public:  
                                  ostream_withassign();  
                                  ostream_withassign(streambuf*   _is);  
                                  ~ostream_withassign();  
          ostream&   operator=(const   ostream&   _os)   {   return   ostream::operator=(_os.rdbuf());   }  
          ostream&   operator=(streambuf*   _sb)   {   return   ostream::operator=(_sb);   }  
  };  
   
  extern   ostream_withassign   _CRTIMP   cout;  
  extern   ostream_withassign   _CRTIMP   cerr;  
  extern   ostream_withassign   _CRTIMP   clog;  
   
  inline   _CRTIMP   ostream&   __cdecl   flush(ostream&   _outs)   {   return   _outs.flush();   }  
  inline   _CRTIMP   ostream&   __cdecl   endl(ostream&   _outs)   {   return   _outs   <<   '\n'   <<   flush;   }  
  inline   _CRTIMP   ostream&   __cdecl   ends(ostream&   _outs)   {   return   _outs   <<   char('\0');   }  
   
  _CRTIMP   ios&                       __cdecl   dec(ios&);  
  _CRTIMP   ios&                       __cdecl   hex(ios&);  
  _CRTIMP   ios&                       __cdecl   oct(ios&);  
   
  #ifdef     _MSC_VER  
  //   Restore   default   packing  
  #pragma   pack(pop)  
  #endif     //   _MSC_VER  
   
  #endif     //   _INC_OSTREAM  
   
  #endif     /*   __cplusplus   */  
   
  这段代码实现什么功能,要达到什么目的  
  帮忙每个语句详细的翻译一下,多谢了 问题点数:40、回复次数:7Top

1 楼willingbupt(buptcsdn)回复于 2006-03-04 16:22:21 得分 3

自己查一下MSDN就是Top

2 楼yuyes(无业游民)回复于 2006-03-04 16:24:14 得分 3

*Purpose:  
  *               This   file   defines   the   classes,   values,   macros,   and   functions  
  *               used   by   the   ostream   class.  
   
  每个语句详细的翻译一下,应该可以写一本书了吧Top

3 楼cenlmmx(学海无涯苦作舟)回复于 2006-03-04 16:26:07 得分 3

呵呵,说的是Top

4 楼yuchen2006(雨晨)回复于 2006-03-04 17:00:19 得分 0

我想知道每句话是什么意思就行??Top

5 楼caijize(砂子)回复于 2006-03-04 17:10:25 得分 3

这是一个头文件,  
  你不需要知道里面的内容是什么意思,  
  十年后你也许都不会知道,  
  直接用就是了。Top

6 楼ugg(逸学堂(exuetang.net))回复于 2006-03-04 19:34:57 得分 25

***  
  //   头文件说明,版权,文件来源等  
  *ostream.h   -   definitions/declarations   for   the   ostream   class  
  *  
  *               Copyright   (c)   1991-1997,   Microsoft   Corporation.     All   rights   reserved.  
  *  
  *Purpose:  
  *               This   file   defines   the   classes,   values,   macros,   and   functions  
  *               used   by   the   ostream   class.  
  *               [AT&T   C++]  
  *  
  *               [Public]  
  *  
  ****/  
   
  #if           _MSC_VER   >   1000  
  #pragma   once//   告诉编译器,这个文件只编译一次  
  #endif  
   
  #ifdef     __cplusplus//   什么这是一个C++文件  
   
  #ifndef   _INC_OSTREAM//   这句功能同#pragma   once,这个从C++语句控制  
  #define   _INC_OSTREAM  
   
  #if           !defined(_WIN32)   &&   !defined(_MAC)  
  #error   ERROR:   Only   Mac   or   Win32   targets   supported!  
  #endif  
   
   
  #ifdef     _MSC_VER  
  //   Currently,   all   MS   C   compilers   for   Win32   platforms   default   to   8   byte  
  //   alignment.  
  #pragma   pack(push,8)//   内存对齐  
   
  #include   <useoldio.h>  
   
  #endif     //   _MSC_VER  
   
  /*   Define   _CRTIMP   */  
   
  #ifndef   _CRTIMP  
  #ifdef     _DLL  
  #define   _CRTIMP   __declspec(dllimport)  
  #else       /*   ndef   _DLL   */  
  #define   _CRTIMP  
  #endif     /*   _DLL   */  
  #endif     /*   _CRTIMP   */  
   
   
  #include   <ios.h>//   包括ios.h文件  
   
  #ifdef     _MSC_VER  
  //   C4514:   "unreferenced   inline   function   has   been   removed"  
  #pragma   warning(disable:4514)   //   disable   C4514   warning  
  //   #pragma   warning(default:4514)                 //   use   this   to   reenable,   if   desired  
  #endif     //   _MSC_VER  
   
  typedef   long   streamoff,   streampos;//   定义宏,描述流字符位置。  
   
  class   _CRTIMP   ostream   :   virtual   public   ios   {//   ostream类继承  
   
  public:  
                  ostream(streambuf*);//   构造析构函数  
                  virtual   ~ostream();  
   
                  ostream&   flush();//   刷新  
                  int     opfx();  
                  void   osfx();  
   
  //   重载<<操作符号  
  inline     ostream&   operator<<(ostream&   (__cdecl   *   _f)(ostream&));  
  inline     ostream&   operator<<(ios&   (__cdecl   *   _f)(ios&));  
                  ostream&   operator<<(const   char   *);  
  inline     ostream&   operator<<(const   unsigned   char   *);  
  inline     ostream&   operator<<(const   signed   char   *);  
  inline     ostream&   operator<<(char);  
                  ostream&   operator<<(unsigned   char);  
  inline     ostream&   operator<<(signed   char);  
                  ostream&   operator<<(short);  
                  ostream&   operator<<(unsigned   short);  
                  ostream&   operator<<(int);  
                  ostream&   operator<<(unsigned   int);  
                  ostream&   operator<<(long);  
                  ostream&   operator<<(unsigned   long);  
  inline     ostream&   operator<<(float);  
                  ostream&   operator<<(double);  
                  ostream&   operator<<(long   double);  
                  ostream&   operator<<(const   void   *);  
                  ostream&   operator<<(streambuf*);  
  inline     ostream&   put(char);  
                  ostream&   put(unsigned   char);  
  inline     ostream&   put(signed   char);  
                  ostream&   write(const   char   *,int);  
  inline     ostream&   write(const   unsigned   char   *,int);  
  inline     ostream&   write(const   signed   char   *,int);  
                  ostream&   seekp(streampos);  
                  ostream&   seekp(streamoff,ios::seek_dir);  
                  streampos   tellp();  
   
  protected:  
                  ostream();  
                  ostream(const   ostream&);                 //   treat   as   private  
                  ostream&   operator=(streambuf*);   //   treat   as   private  
                  ostream&   operator=(const   ostream&   _os)   {return   operator=(_os.rdbuf());   }  
                  int   do_opfx(int);                               //   not   used  
                  void   do_osfx();                                   //   not   used  
   
  private:  
                  ostream(ios&);  
                  ostream&   writepad(const   char   *,   const   char   *);  
                  int   x_floatused;  
  };  
   
  inline   ostream&   ostream::operator<<(ostream&   (__cdecl   *   _f)(ostream&))   {   (*_f)(*this);   return   *this;   }  
  inline   ostream&   ostream::operator<<(ios&   (__cdecl   *   _f)(ios&   ))   {   (*_f)(*this);   return   *this;   }  
   
  inline     ostream&   ostream::operator<<(char   _c)   {   return   operator<<((unsigned   char)   _c);   }  
  inline     ostream&   ostream::operator<<(signed   char   _c)   {   return   operator<<((unsigned   char)   _c);   }  
   
  inline     ostream&   ostream::operator<<(const   unsigned   char   *   _s)   {   return   operator<<((const   char   *)   _s);   }  
  inline     ostream&   ostream::operator<<(const   signed   char   *   _s)   {   return   operator<<((const   char   *)   _s);   }  
   
  inline     ostream&   ostream::operator<<(float   _f)   {   x_floatused   =   1;   return   operator<<((double)   _f);   }  
   
  inline     ostream&   ostream::put(char   _c)   {   return   put((unsigned   char)   _c);   }  
  inline     ostream&   ostream::put(signed   char   _c)   {   return   put((unsigned   char)   _c);   }  
   
  inline     ostream&   ostream::write(const   unsigned   char   *   _s,   int   _n)   {   return   write((char   *)   _s,   _n);   }  
  inline     ostream&   ostream::write(const   signed   char   *   _s,   int   _n)   {   return   write((char   *)   _s,   _n);   }  
   
   
  class   _CRTIMP   ostream_withassign   :   public   ostream   {  
                  public:  
                                  ostream_withassign();  
                                  ostream_withassign(streambuf*   _is);  
                                  ~ostream_withassign();  
          ostream&   operator=(const   ostream&   _os)   {   return   ostream::operator=(_os.rdbuf());   }  
          ostream&   operator=(streambuf*   _sb)   {   return   ostream::operator=(_sb);   }  
  };  
   
  extern   ostream_withassign   _CRTIMP   cout;  
  extern   ostream_withassign   _CRTIMP   cerr;  
  extern   ostream_withassign   _CRTIMP   clog;  
   
  inline   _CRTIMP   ostream&   __cdecl   flush(ostream&   _outs)   {   return   _outs.flush();   }  
  inline   _CRTIMP   ostream&   __cdecl   endl(ostream&   _outs)   {   return   _outs   <<   '\n'   <<   flush;   }  
  inline   _CRTIMP   ostream&   __cdecl   ends(ostream&   _outs)   {   return   _outs   <<   char('\0');   }  
   
  _CRTIMP   ios&                       __cdecl   dec(ios&);  
  _CRTIMP   ios&                       __cdecl   hex(ios&);  
  _CRTIMP   ios&                       __cdecl   oct(ios&);  
   
  #ifdef     _MSC_VER  
  //   Restore   default   packing  
  #pragma   pack(pop)  
  #endif     //   _MSC_VER  
   
  #endif     //   _INC_OSTREAM  
   
  #endif     /*   __cplusplus   */  
  Top

7 楼jiazhen(go go go)回复于 2006-03-04 20:55:52 得分 3

这个东西的功能等同于stdlib.h><stdio.h>等等之类,只不过是自己定义的而已.我们只要会用它给我们的功能就行了.Top

相关问题

  • 帮忙翻译一小段代码
  • 一段VB代码,帮我翻译成Delphi代码,谢谢!!
  • 一段VB代码,请各位翻译成VC++代码,谢谢
  • 翻译一句代码
  • 麻烦翻译一段c语言代码为vb代码,在线等,急!!!
  • 将一段delphi加密码算法翻译为c#代码
  • 散分!!一段代码的翻译,从C++ 到 ASP,谢谢!
  • 200分求一小段代码淂翻译 c# - vb.net
  • 谁帮我翻译一句代码
  • CBitmap的创建问题,下面一段delphi 代码如何翻译成c 代码?

关键词

  • win32
  • 文件
  • mac
  • virtual
  • dll
  • crtimp
  • ostream
  • msc
  • endif
  • ifdef

得分解答快速导航

  • 帖主:yuchen2006
  • willingbupt
  • yuyes
  • cenlmmx
  • caijize
  • ugg
  • jiazhen

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo