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

linux控制台显示中文

#include <stdio.h>
#include <wchar.h>
#include <locale.h>
int main()
{
#ifdef _WIN32
  setlocale(LC_ALL, "chs");
#else
  setlocale(LC_ALL, "zh_CN.UTF-8");
#endif
  wchar_t KZg[] = {0x6211, 0};
  char buf[10] = {0};
  wcstombs(buf,KZg,10);
  printf("_%s_\n",buf);
}
wchar_t 在linux上是4个字节, 在win32上是2个字节, MinGW也是2个字节.
一般会节省空间使用utf-16.
#ifdef _WIN32
  typedef wchar_t uchar;
#else
  typedef unsigned short uchar; // 就不能使用string.h提供的宽字符串方法了.
#endif
linux上使用string常量只能用{}.


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

Linux内存管理之slab分配器分析(续五)

 九:几点补充:
1: Slab中使用的页面都会加上“PG_slab”标志,以跟一般的页面区别。另外,在释放内存的时候,经常需要用到从页面到slab的对应转换关系。那是怎样标识的呢?
关于标志:
注意有以下代码:
static void *kmem_getpages(kmem_cache_t *cachep, int flags, int nodeid)
{
  &n ......

Linux 系统时间设置、编程总结

未完待续...
设置时间:
date -s "2009/11/08 11:23:00"
硬件时钟与系统时间同步一下:
hwclock --systohc
编程:
#include <cstdlib>
time_t time(time_t *timer)
调用后将当前系统时间与1900年1月1日相差的秒数存入到timer中,timer可看成是一个长整型数
具体描述:
  函数原型:  ......

Linux jffs2 使用总结

1.在Linux启动脚本中制作jffs2
2.在Linux终端下制作jffs2
3.备注
1.在Linux启动脚本中制作jffs2
 具体操作步骤:
 sysinit中:
 
echo “Make jffs2 filesystem:”
erase /dev/mtd5
cd /tmp
echo “test” > test.txt
mkfs.jffs2 –d /tmp > /dev/mtdblock5
&nbs ......

关于linux下的软链接和硬链接

 连接上了服务器,检查一下。磁盘空间不够了
[java@localhost ~]$ df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 5.8G 5.8G 0M 100% /
/dev/hda1 99M 8.5M 86M 10% /boot
none 506M 0 506M 0% /dev/shm
/dev/hda6 20G 77M 19G 1% /tmp
/dev/hda5 20G 14G 5.2G 72% /usr/local
/dev/hd ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号