易截截图软件、单文件、免安装、纯绿色、仅160KB

ruby c++

While looking for information on the subject, I looked into the ONLamp article Extending Ruby with C by Garrett Rooney, the Extending Ruby chapter in the Pickaxe, README.EXT (located at /usr/share/doc/ruby1.8-dev/README.EXT.gz on my Ubuntu system) and got some help from Kjetil.
The resulting file can be found here: wtmplist.c.
Disclaimer: I’m not resposible if you should destroy something with your newfound skills, nor am I responsible if you should suddenly get the urge to leave your wife/loved ones in favor of Ruby.
Table of Contents:
What to Extend?
How Do I Want the Interface to Be?
Get to it! #include <ruby.h>
Groundwork.
Making it Compile.
Collect the Data th Make Available.
Adding More Functionality.
Test Your New Library.
What to Extend?
Obviously you start by figuring out what you want to extend Ruby with. Some library missing, or better implemented in C? Some library you wrote yourself and want to be able to use from Ruby scripts?
I have a project coming up where I’ll have to look into /var/log/wtmp to get login entries, and didn’t find any classes/modules that made this possible in Ruby. There are documented (through Man) C functions to access the structures in the file, so I started to look at the introductions to extending Ruby (regrettably I somehow forgot about the Pickaxe at this point, but Kjetil reminded me after I had been cursing for a while).
Moving on to the next step …
How Do I Want the Interface to Be?
The point here is to think how you would like the information and methods represented in Ruby. In my case, I want to read in all entries in wtmp, and have them available in a list of some sort. In Ruby that means using the array. So an Array of entries doesn’t sound too bad. To make things cleaner, I’ll also put it in a module. This maps to this Ruby code (roughly):
module Wtmp
class List < Array
def initialize
# open wtmp
# wtmp.each_struct


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

c/c++强制类型转换

 Q:什么是C风格转换?什么是static_cast, dynamic_cast 以及 reinterpret_cast?区别是什么?为什么要注意?
A:转换的含义是通过改变一个变量的类型为别的类型从而改变该变量的表示方式。为了类型转换一个简单对象为另一个对象你会使用传统的类型转换操作符。比如,为了转换一个类型为doubole的浮点数的指针到整型: ......

Linux下C++实现PHP扩展中级应用(一)


此篇文章准备分2个部分来讲述:
    第一部分主要详细讲述一下怎么构建一个完成的C++应用扩展模块;
   
第二部分主要讲述在PHP及Zend框架下怎么使用Zend API和C++语言来实现自己所要的功能以及项目的开发;
    此篇文章所运用的环境在Linux
2.4.21-4.ELsmp(Red Ha ......

PHP >C++转换工具

   毋庸置疑,PHP是一种非常棒的动态网页制作语言,他和C的极高相似性,使得它的语法学起来
很容易,他有很多类似C语言库函数的东西,还有像日期,字符串和时间函数等,这使得它很容
易开发相当复杂的应用程序。
    当PHP应用到关键web站点上,如何保证质量将会变得很关键。然而,PHP并不是一 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号