CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - main.c
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Sub Category
Network Marketing
Management
E-commerce
Business guide
Business plan
Successful incentive
Human Resources
Report papers
Marketing materials
Consulting and training
Website
Software Engineering
File Format
Technology Management
Industry research
Program doc
Other
Search - main.c - List
[
Documents
]
javaNIO
DL : 0
一系列缓冲区类支撑起了 Java 2 平台标准版的新 I/O(NIO)包。这些类的数据容器形成了其它 NIO 操作(如套接字通道上的非阻塞读取)的基础。在本月的 Merlin 的魔力中,常驻 Java 编程专家 John Zukowski 展示了如何操作那些数据缓冲区来执行如读/写原语这样的任务以及如何使用内存映射文件。在以后的文章里,他将把这里所提到的概念扩展到套接字通道的使用。 Java 2 平台标准版(Java 2 Platform Standard Edition,J2SE)1.4 对 Java 平台的 I/O 处理能力做了大量更改。它不仅用流到流的链接方式继续支持以前 J2SE 发行版的基于流的 I/O 操作,而且 Merlin 还添加了新的功能 — 称之为新 I/O 类(NIO),现在这些类位于 java.nio 包中。 I/O 执行输入和输出操作,将数据从文件或系统控制台等传送至或传送出应用程序。(有关 Java I/O 的其它信息,请参阅 参考资料)。 缓冲区基础 抽象的 Buffer 类是 java.nio 包支持缓冲区的基础。 Buffer的工作方式就象内存中用于读写基本数据类型的 RandomAccessFile 。象 RandomAccessFile一样,使用 Buffer ,所执行的下一个操作(读/写)在当前某个位置发生。执行这两个操作中的任一个都会改变那个位置,所以在写操作之后进行读操作不会读到刚才所写的内容,而会读到刚才所写内容之后的数据。 Buffer 提供了四个指示方法,用于访问线性结构(从最高值到最低值): "capacity() :表明缓冲区的大小 "limit() :告诉您到目前为止已经往缓冲区填了多少字节,或者让您用 :limit(int newLimit) 来改变这个限制 "position() :告诉您当前的位置,以执行下一个读/写操作 "mark() :为了稍后用 reset() 进行重新设置而记住某个位置 缓冲区的基本操作是 get() 和 put() ;然而,这些方法在子类中都是针对每种数据类型的特定方法。为了说明这一情况,让我们研究一个简单示例,该示例演示了从同一个缓冲区读和写一个字符。在清单 1 中, flip() 方法交换限制和位置,然后将位置置为 0,并废弃标记,让您读刚才所写的数据: 清单 1. 读/写示例 import java.nio.*; ... CharBuffer buff = ...; buff.put('A'); buff.flip(); char c = buff.get(); System.out.println("An A: " + c); 现在让我们研究一些具体的 Buffer 子类。 回页首 缓冲区类型 Merlin 具有 7 种特定的 Buffer 类型,每种类型对应着一个基本数据类型(不包括 boolean): "ByteBuffer "CharBuffer "DoubleBuffer "FloatBuffer "IntBuffer "LongBuffer "ShortBuffer 在本文后面,我将讨论第 8 种类型 MappedByteBuffer ,它用于内存映射文件。如果您必须使用的类型不是这些基本类型,则可以先从 ByteBuffer 获得字节类型,然后将其转换成 Object 或其它任何类型。 正如前面所提到的,每个缓冲区包含 get() 和 put() 方法,它们可以提供类型安全的版本。通常,需要重载这些 get() 和 put() 方法。例如,有了 CharBuffer ,可以用 get() 获得下一个字符,用 get(int index) 获得某个特定位置的字符,或者用 get(char[] destination) 获得一串字符。静态方法也可以创建缓冲区,因为不存在构造函数。那么,仍以 CharBuffer为例,用 CharBuffer.wrap(aString) 可以将 String对象转换成 CharBuffer 。为了演示,清单 2 接受第一个命令行参数,将它转换成 CharBuffer ,并显示参数中的每个字符: 清单 2. CharBuffer 演示 import java.nio.*; public class ReadBuff { public static void main(String args[]) { if (args.length != 0) { CharBuffer buff = CharBuffer.wrap(args[0]); for (int i=0, n=buff.length(); i<n; i++) { System.out.println(i + " : " + buff.get()); } } } } 请注意,这里我使用了 get() ,而没有使用 get(index) 。我这样做的原因是,在每次执行 get() 操作之后,位置都会移动,所以不需要手工来声明要检索的位置。 回页首 直接 vs. 间接 既然已经了解了典型的缓冲区,那么让我们研究直接缓冲区与间接缓冲区之间的差别。在创建缓冲区时,可以要求创建直接缓冲区,创建直接缓冲区的成本要比创建间接缓冲区高,但这可以使运行时环境直接在该缓冲区上进行较快的本机 I/O 操作。因为创建直接缓冲区所增加的成本,所以直接缓冲区只用于长生存期的缓冲区,而不用于短生存期、一次性且用完就丢弃的缓冲区。而且,只能在 ByteBuffer 这个级别上创建直接缓冲区,如果希望使用其它类型,则必须将 Buffer 转换成更具体的类型。为了演示,清单 3 中代码的行为与清单 2 的行为一样,但清单 3 使用直接缓冲区: 清单 3. 列出网络接口 import java.nio.*; public class ReadDirectBuff { public static void main(String args[]) { if (args.length != 0) { String arg = args[0]; int size = arg.length(); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(size*2); CharBuffer buff = byteBuffer.asCharBuffer(); buff.put(arg); buff.rewind(); for (int i=0, n=buff.length(); i<n; i++) { System.out.println(i + " : " + buff.get()); } } } } 在上面的代码中,请注意,不能只是将 String 包装在直接 ByteBuffer中。必须首先创建一个缓冲区,先填充它,然后将位置倒回起始点,这样才能从头读。还要记住,字符长度是字节长度的两倍,因此示例中会有 size*2 。 回页首 内存映射文件 第 8 种 Buffer 类型 MappedByteBuffer 只是一种特殊的 ByteBuffer 。 MappedByteBuffer 将文件所在区域直接映射到内存。通常,该区域包含整个文件,但也可以只映射部分文件。所以,必须指定要映射文件的哪部分。而且,与其它 Buffer 对象一样,这里没有构造函数;必须让 java.nio.channels.FileChannel的 map() 方法来获取 MappedByteBuffer 。此外,无需过多涉及通道就可以用 getChannel() 方法从 FileInputStream 或 FileOutputStream获取 FileChannel 。通过从命令行传入文件名来读取文本文件的内容,清单 4 显示了 MappedByteBuffer : 清单 4. 读取内存映射文本文件 import java.io.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*; public class ReadFileBuff { public static void main(String args[]) throws IOException { if (args.length != 0) { String filename = args[0]; FileInputStream fis = new FileInputStream(filename); FileChannel channel = fis.getChannel(); int length = (int)channel.size(); MappedByteBuffer byteBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, length); Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); CharBuffer charBuffer = decoder.decode(byteBuffer); for (int i=0, n=charBuffer.length(); i<n; i++) { System.out.print(charBuffer.get()); } } } }
Date
: 2010-09-20
Size
: 5.74kb
User
:
635868631@qq.com
[
Documents
]
CRC循环校验的具体算法
DL : 0
Filename: main.c * Description: A simple test program for the CRC implementations. * Notes: To test a different CRC standard, modify crc.h. * * * Copyright (c) 2000 by Michael Barr. This software is placed into * the public domain and may be used for any purpose. However, this * notice must not be changed or removed and no warranty is either * expressed or implied by its publication or distribution. -Filename: main.c* Description: A simple test program for the CRC implementations.* Notes: To test a different CRC standard, modify crc.h.*** Copyright (c) 2000 by Michael Barr. This software is placed into* the public domain and may be used for any purpose. However, this* notice must not be changed or removed and no warranty is either* expressed or implied by its publication or distribution.
Date
: 2025-12-19
Size
: 2kb
User
:
韩卫东
[
Documents
]
matrix_word
DL : 0
一篇介绍矩阵运算的文章,包括了主要的代码,word文件。-introduced a matrix calculation of the article, including the main code word document.
Date
: 2025-12-19
Size
: 6kb
User
:
李宏仲
[
Documents
]
c语言教程(www.vcok.com版)
DL : 2
经典c程序100例==1--10 【程序1】 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? 1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去 掉不满足条件的排列。 2.程序源代码: main() { int i,j,k printf("\n") for(i=1 i<5 i++) /*以下为三重循环*/ for(j=1 j<5 j++) for (k=1 k<5 k++) { if (i!=k&&i!=j&&j!=k) /*确保i、j、k三位互不相同*/ printf("%d,%d,%d\n",i,j,k) }-classic procedures hundred cases == 1-- 10 procedures-- a topic : 1,2,3,4 figures, the number can be formed with each other with no repeat of the triple-digit figures? How many are? 1. Program Analysis : can fill the 100, 10, 000 the number of spaces are 1,2,3,4. With all the components removed after not satisfied with the conditions. 2. Source code : main () (int i, j, k printf ( "\ n") for (i = 1 ilt; 5 i)/* the following as the triple cycle*/for (j = 1 JLT; 5 j) for (k = 1 KLT; 5 k) (if (i! = ki! = jj! = k)/* i, j, k three disparate*/printf ( "% d,% d,% d \ n ", i, j, k
Date
: 2025-12-19
Size
: 297kb
User
:
刘宋
[
Documents
]
Windowscalculator
DL : 0
本文需要你事先了解面向对象的基于消息驱动的 Windows 消息编程,当然,对于编写这个计算器,你不必知道太多的windows编程,你重要会编写基于对话框的简单应用程序就可以了。 首先,让我们来仔细了解一下mircosoft的计算器吧,我们发现它是一个基于对话框的含有两的主对话框、一个关于对话框、一个菜单的应用程序。也就是说,我们应该创建一个基于对话框的应用程序,并且为其添加一个菜单和一个主对话框(因为,应用程序已经创建好了一个主对话框和关于对话框)。 -paper you need to advance understanding of the object-oriented message-driven programming Windows news, of course, For the preparation of this calculator, you do not need to know too many windows programming, You will be important to prepare a simple dialog-based applications on it. First of all, let us know in detail what the calculator mircosoft bar, We found that it is based on a dialog box containing two of the main dialog, a dialog on, a menu of applications. In other words, we should create a dialog-based applications, and for adding a main menu and a dialog box (because, Application procedures have been well-established and one of the main dialog box).
Date
: 2025-12-19
Size
: 2kb
User
:
monkeylzj
[
Documents
]
c++slash
DL : 0
C++讲义,需要的大家下,内容不错,主要是虚函数部分-C++ Notes, the U.S. needs, the content is true that the main part is the virtual function
Date
: 2025-12-19
Size
: 50kb
User
:
刘军利
[
Documents
]
code
DL : 0
对偶单纯形法的迭代仍然是以为主元的旋转变换,但是它也有自己的特点。它是首先确定离开基的变量,即首先确定然后确定进入基的变量,即确定xk,一下就是求解单纯形法一例-Dual simplex method iteration is still the main element of the rotation transformation, but it also has its own characteristics. It is the first to leave the base to determine the variables, namely, first to identify and then determine the variables to enter the base, that is, to determine xk, what is the simplex method to solve a case
Date
: 2025-12-19
Size
: 6kb
User
:
蒙仕旺
[
Documents
]
cmain
DL : 0
c语言的main的所有写法_C语言教程_C++教程_C语言培训_C++教程培训 c语言的main的所有写法_C语言教程_C++教程_C语言培训_C++教程培训-c of the main language of all written _C Language Seiries _C++ Tutorial _C language training _C++ Course training c of all the main languages written _C Language Seiries _C++ Guide language training _C _ C++ tutorial training
Date
: 2025-12-19
Size
: 3kb
User
:
地址
[
Documents
]
linux-GCC-guide
DL : 0
Linux的发行版中包含了很多软件开发工具. 它们中的很多是用于 C 和 C++应用程序开发的. 本文介绍了在 Linux 下能用于 C 应用程序开发和调试的工具. 本文的主旨是介绍如何在 Linux 下使用 C 编译器和其他 C 编程工具, 而非 C 语言编程的教程. -Linux distributions contain a lot of software development tools. Many of them for C and C++ application development. In this paper, can be used in C under Linux application development and debugging tools. The main thrust of this paper is to introduce the Linux how to use C compiler and other C programming tools, rather than the C programming language tutorial.
Date
: 2025-12-19
Size
: 167kb
User
:
秋子
[
Documents
]
functiontable
DL : 0
此文档主要描述了Asp.net(C#)常用函数,对设计者很有用。常用函数表-This document describes the main Asp.net (C#) commonly used functions useful for designers.
Date
: 2025-12-19
Size
: 8kb
User
:
liu xiao fen
[
Documents
]
1
DL : 0
1.编写一个简单的程序,输出“Welcome you”,并给程序加一行注释“First C++ program”。 2.编写一个完整的包含输入和输出的简单C++程序。 3.编写内置函数求解2X2+4X+5的值,X为整数,并用主函数调用该函数。 4.利用函数重载,重载上面的函数,X为浮点数。 5.编写一个程序,对一个整数数组求和,求和的结果使用全局变量sum存储,同时对整数中的奇数求和,结果使用局部变量sum存储,在主程序将两个结果输出。 6.编写一个程序动态分配一个浮点空间,输入一个数到该空间中,计算以该数为半径的圆点面积并在屏幕上显示,最后释放该空间,请使用new、delete运算符。-1. Write a simple program, the output "Welcome you", and add a line to the program notes "First C++ program". 2. To prepare a complete input and output that contains a simple C++ program. 3. Preparation of built-in functions for solving 2X2+4 X+5 value, X is an integer, and use the main function calls the function. 4. The use of function overloading, function overloading above, X as a floating-point number. 5. Write a program, for an array of integers the sum, sum sum the results of the use of global variables to store, while the odd integers in the sum, the results of the use of local variable sum is stored in the main program will be two results output. 6. Write a program that dynamically allocates space for a floating-point, enter a number into the space, calculated on the number of area and radius of the dots displayed on the screen, the final release of the space, please use the new, delete operator.
Date
: 2025-12-19
Size
: 45kb
User
:
bobo
[
Documents
]
c
DL : 0
定义一个车(vehicle)基类,有Run、Stop等成员函数,由此派生出自行车(bicycle)类、汽车(motorcar)类,从bicycle和motorcar派生出摩托车(motorcycle)类,它们都有Run、Stop等成员函数。在main()函数中定义vehicle、bicycle、motorcar、motorcycle的对象,调用其Run()、Stop()函数,观察其执行情况。再分别用vehicle类型的指针来调用这几个对象的成员函数,看看能否成功;把Run、Stop定义为虚函数,再试试看。-The definition of a car (vehicle) base class, with Run, Stop and other member functions, thus derived a bike (bicycle), automobiles (motorcar) class, derived from the bicycle and motorcar motorcycle (motorcycle) class, they all Run , Stop and other member functions. In the main () function is defined in the vehicle, bicycle, motorcar, motorcycle object, call its Run (), Stop () function is to observe its implementation. Each with a pointer with the vehicle type to call the member functions of these objects to see if successful the Run, Stop is defined as virtual functions, try again.
Date
: 2025-12-19
Size
: 43kb
User
:
黄超
[
Documents
]
123456
DL : 0
本设计的主要内容是用单片机系统进行温度实时采集与控制。温度信号由AD590K和温度/电压转换电路提供,对AD590K进行了精度优于正负0.1°C的非线性补偿,温度实时控制采用分段非线性和积分分离PI算法,其分段点是设定温度的函数。控制输出来用脉冲移相触发可控硅来调节加热丝有效功率。系统具备较高的测量精度和控制精度-The main content of this design is to use real-time microcontroller system acquisition and control the temperature. Temperature signal from the AD590K and temperature/voltage conversion circuit provided on the AD590K was plus or minus 0.1 ° C accuracy of better than non-linear compensation, the temperature real-time control and integration with sub-linear algorithm for separation of PI and its sub-point is Set a function of temperature. Control output to trigger a pulse thyristor phase-shift effective power to regulate the heating wire. The system has a higher measurement precision and control accuracy
Date
: 2025-12-19
Size
: 347kb
User
:
wang
[
Documents
]
program
DL : 0
实现c语言的词法分析器,用文件读取,要求能识别整数、自定义标识符及以下关键字: + - * / < <= == != > >= & && || = ( ) [ ] { } : , void int float char if else while do ! main -Achieve c language lexical analyzer, using file read, the request can identify integers, custom identifiers and the following keywords:+-*/< < = ==! => > = & & & | | = () [] (): , void int float char if else while do! main
Date
: 2025-12-19
Size
: 2kb
User
:
孔秀平
[
Documents
]
ARMandc
DL : 0
arm的c语言编程以及汇编指令集,对与初学者有一定的指导作用-arm about c language and the brief introduction of arm,making it easer for you to learn arm.you can get the main idea of arm after learing this,i don t know why so many words
Date
: 2025-12-19
Size
: 283kb
User
:
王飞
[
Documents
]
C
DL : 0
.请编写函数fun,该函数的功能是:实现B=A+A ,即把矩阵A加上A的转置,存放在矩阵B中。计算结果在main函数中输出-. Please write the function fun, the function of the functions are: to achieve B = A+ A ' , ie the matrix A with A, transpose, stored in the matrix B,. The results in the main function output
Date
: 2025-12-19
Size
: 650kb
User
:
林静
[
Documents
]
C#命名空间大全
DL : 0
c#的命名空间大全,包括空间主要组件及其用法。(C# namespace Daquan, including the main components of space and its usage.)
Date
: 2025-12-19
Size
: 33kb
User
:
hasean
[
Documents
]
main
DL : 0
实现金额数值的中文转换成阿拉伯数字,也可以将中文数字,转换成阿拉伯数字(The value of the amount is translated into the Arabia number, and the Chinese numbers can be converted into Arabia numbers.)
Date
: 2025-12-19
Size
: 4kb
User
:
授勋人
[
Documents
]
STM32F427工程模板
DL : 0
STM32F427VGT6 project template,it can be used directly to program applications in function main().
Date
: 2025-12-19
Size
: 662kb
User
:
lqz666lqz
[
Documents
]
Audio-equalizer-using-C-on-DSP-kit--DSK6713--main
DL : 0
This is a C code which has 3 user defined functions. AudioRead(), Filter() and AudioWrite(). The AudioRead() function read the .wav file and retrieve their samples. The filter() function does convolutions on input audio samples with matlab’s filter coefficients. The AudioWrite() then take these output samples as input and write them in a wav file. For this Project the DSP kit used is DSK6713.
Date
: 2024-12-22
Size
: 49.94mb
User
:
bourouba2004@yahoo.fr
«
1
2
»
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.