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

ArcSDE C APi的C#调用

选两个比较有代表性的函数
首先下载安装sdk,将其中的sde.dll,pe.dll和sg.dll拷贝过来
使用如下的代码,指定dll后直接调用其中的函数,
/// <summary>
/// Sets the value for a small integer column.
/// </summary>
[DllImport(".\\sde91.dll", SetLastError = true, ThrowOnUnmappableChar = true)]
public static extern Int32 SE_stream_set_smallint(IntPtr stream, Int16 column, sbyte[] short_val);
/// <summary>
/// Sets the value for a string column.
/// </summary>
[DllImport(".\\sde91.dll", SetLastError = true, ThrowOnUnmappableChar = true)]
public static extern Int32 SE_stream_set_nstring(IntPtr stream, Int16 column, byte[] string_val);
 
在插入数据时使用到的两个函数,一个是插入string,另一个是插入smallint(short型)
在c#中,string是unicode的,所以需要使用函数SE_stream_set_nstring
此函数的第三个参数如以上代码中的,如果直接写为string,则对于中文字符,出来的就是乱码了
使用byte,然后调用时如下:
ret = Stream.SE_stream_set_nstring(insertStream, 3, (new UnicodeEncoding()).GetBytes("测试"));
 
对于smallint型,在SE_stream_set_smallint函数中直接使用short,
也出现错误,不知道为什么,后来想到
C#中的sbyte是8位的,两个组成的数组就是一个short(16位有符号整型)
然后试了试,果然可用,
使用的时候注意,比如要存入一个变量ashort;
sbyte[0]中的数值,可以为小于256的值
当数值大于256时(1<<8)
sbyte[1]就是数值ashort>>8;
sbyte[0]为ashor-((ashort>>8)<<8)
使用位运算,简单方便效率高,不知道还有没有其他不需要转换的方法


相关文档:

s3c2440基于linux的button和led字符设备驱动

先是内核驱动程序:
#include <linux/module.h>//具体的头文件位置为/opt/FriendlyARM/mini2440/linux-2.6.29/include/linux/*.h
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <l ......

C Language: A Example of Print Snake Matrix


// SnakeMatrix.cpp : Defines the entry point for the console application.
// Create by Xianyi.Ye, May 4,2010
#include "stdafx.h"
#include <iostream.h>
/*
Question: Print a Sanke Matrix as following
i\j 1 2 3 4 5 6
1 1 2 9 10 25 26
2 4 3 8 11 24 27
3 5 6 7 12 23 28
4 16 15 14 ......

打开IE说无法找到脚本文件【C:Progeam Files\*】

今天发现电脑出现莫名奇妙的问题,任务栏的图标都无法使用了。而且注册表也无法使用。
处理方法:
一、先解锁注册表。此步骤后可以正常访问修改注册表。
http://zhidao.baidu.com/question/8109053.html?fr=ala0
注册表被管理员停用,
1、新建一个文本文件,在其中输入以下内容。
[HKEY_CURRENT_USER/Software/Micro ......

LINUX C 定时器

【实现功能】:Linux下的C编程:编写一个程序(库),实现定时器(计时器)的功能,它能为用户提供在同一进程中多次使用的定时器。这里要求用信号来实现。
【解题思路】:编写一个结构体Timer代表一个计时器,然后再定义Timer类型的数组myTimer[N],用来保存我们设置的定时器;再定义函数setTimer()生成计时器,并将生成 ......

LINUX C 时间操作

  1.时间表示
    在程序当中,我们经常要输出系统当前的时间,比如我们使用date命令的输出结果.这个时候我们可以使用下面两个函数:
#include <sys/time.h>
time_t time(time_t *tloc);
char *ctime(const time_t *clock);
    time函数返回从1970年1月1日0 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号