计算机专业外文翻译--c++的起源一个小的历史

上传人:自*** 文档编号:80538547 上传时间:2019-02-19 格式:DOC 页数:7 大小:54.50KB
返回 下载 相关 举报
计算机专业外文翻译--c++的起源一个小的历史_第1页
第1页 / 共7页
计算机专业外文翻译--c++的起源一个小的历史_第2页
第2页 / 共7页
计算机专业外文翻译--c++的起源一个小的历史_第3页
第3页 / 共7页
计算机专业外文翻译--c++的起源一个小的历史_第4页
第4页 / 共7页
计算机专业外文翻译--c++的起源一个小的历史_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《计算机专业外文翻译--c++的起源一个小的历史》由会员分享,可在线阅读,更多相关《计算机专业外文翻译--c++的起源一个小的历史(7页珍藏版)》请在金锄头文库上搜索。

1、外文原文The Origins of C+: A Little HistoryComputer technology has evolved at an amazing rate over the past few decades. Today a notebook computer can compute faster and store more information than the mainframe computers of the 1960s. Computer languages have evolved, too. The changes may not be as dram

2、atic, but they are important. Bigger, more powerful computers spawn bigger, more complex programs, which, in turn, raise new problems in program management and maintenance. In the 1970s, languages such as C and Pascal helped usher in an era of structured programming,a philosophy that brought some or

3、der and discipline to a field badly in need of these qualities. Besides providing the tools for structured programming, C also produced compact,fast-running programs, along with the ability to address hardware matters, such as managing communication ports and disk drives. These gifts helped make C t

4、he dominant programming language in the 1980s. Meanwhile, the 1980s witnessed the growth of a new programming paradigm: object-oriented programming, or OOP, as embodied in languages such as SmallTalk and C+. Lets examine these C and OOP a bit more closely.The Mechanics of Creating a ProgramSuppose y

5、ouve written a C+ program. How do you get it running? The exact steps depend on your computer environment and the particular C+ compiler you use, but they should resemble the following steps:1. Use a text editor of some sort to write the program and save it in a file. This file constitutes the sourc

6、e code for your program.2. Compile the source code. This means running a program that translates the source code to the internal language, called machine language, used by the host computer. The file containing the translated program is the object code for your program.3. Link the object code with a

7、dditional code. For example, C+ programs normally use libraries. A C+ library contains object code for a collection of computer routines, called functions, to perform tasks such as displaying information onscreen or calculating the square root of a number. Linking combines your object code with obje

8、ct code for the functions you use and with some standard startup code to produce a runtime version of your program. The file containing this final product is called the executable code. CAsyncSocketA CAsyncSocket object represents a Windows Socket an endpoint of network communication. Class CAsyncSo

9、cket encapsulates the Windows Sockets API, providing an object-oriented abstraction for programmers who want to use Windows Sockets in conjunction with MFC.This class is based on the assumption that you understand network communications. You are responsible for handling blocking, byte-order differen

10、ces, and conversions between Unicode and multibyte character set (MBCS) strings. If you want a more convenient interface that manages these issues for you, see class CSocket.To use a CAsyncSocket object, call its constructor, then call the Create function to create the underlying socket handle (type

11、 SOCKET), except on accepted sockets. For a server socket call the Listen member function, and for a client socket call the Connect member function. The server socket should call the Accept function upon receiving a connection request. Use the remaining CAsyncSocket functions to carry out communicat

12、ions between sockets. Upon completion, destroy the CAsyncSocket object if it was created on the heap; the destructor automatically calls the Close function. CsocketClass CSocket derives from CAsyncSocket and inherits its encapsulation of the Windows Sockets API. A CSocket object represents a higher

13、level of abstraction of the Windows Sockets API than that of a CAsyncSocket object. CSocket works with classes CSocketFile and CArchive to manage the sending and receiving of data.A CSocket object also provides blocking, which is essential to the synchronous operation of CArchive. Blocking functions

14、, such as Receive, Send, ReceiveFrom, SendTo, and Accept (all inherited from CAsyncSocket), do not return a WSAEWOULDBLOCK error in CSocket. Instead, these functions wait until the operation completes. Additionally, the original call will terminate with the error WSAEINTR if CancelBlockingCall is ca

15、lled while one of these functions is blocking.To use a CSocket object, call the constructor, then call Create to create the underlying SOCKET handle (type SOCKET). The default parameters of Create create a stream socket, but if you are not using the socket with a CArchive object, you can specify a p

16、arameter to create a datagram socket instead, or bind to a specific port to create a server socket. Connect to a client socket using Connect on the client side and Accept on the server side. Then create a CSocketFile object and associate it to the CSocket object in the CSocketFile constructor. Next, create a CArchive object for sending and one for receiving data (as needed), then associate them with the CSocketFile object in the CArchive constructor.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号