布局new操作符能够使我们在分配内存时指定位置。如下代码交代了相关语法: char
*buffer = new char[BUF]; JustTesting *p1, *p2; p1 = new (buffer) JustTesting;
//额外加入的(buffer)用来指定位置这意...
分类:
其他好文 时间:
2014-05-09 04:40:48
阅读次数:
245
相信大家都用过,不过我觉得还是挺好用的,因为在平时写代码总能用到这个截取所以还是分享一下吧。一般来说使用string自带的split就可以,但是split只能按char类型截取,不是很方便。按字符串截取,使用的是正则表达式,简单的两行代码,就解决很多问题。
1 class Program 2 ...
分类:
其他好文 时间:
2014-05-09 03:22:15
阅读次数:
344
Subversion 1.8 and IntelliJ IDEA 13Unlike its
earlier versions, Subversion 1.8 support uses the native command line client
instead of SVNKit to run co...
分类:
其他好文 时间:
2014-05-09 03:07:38
阅读次数:
257
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
测试程序:
#include
#include
struct dev
{
int a;
char b;
float c;
};
struct dev devs[]=
{
{
1,'a',7.0,
},
{
1,'a',7.0,
},
{
...
分类:
系统相关 时间:
2014-05-09 02:10:16
阅读次数:
494
fstat函数用于返回关于文件的信息到一个struct stat结构中,stat结构中的st_mode可以用来区分文件类型。
struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* inode ...
分类:
其他好文 时间:
2014-05-09 02:01:26
阅读次数:
379
chapter 8 内核代码
8.1.1中断处理程序
traps.c
#define get_seg_byte(seg,addr) ({ \ //取seg中addr处1byte
register char __res; __asm__("push %%fs;mov %%ax,%%fs;movb %%fs:%2,%%al;pop %%fs" ...
分类:
系统相关 时间:
2014-05-09 01:48:26
阅读次数:
418
#include
#include
#define FALSE 0 //函数执行错误返回0
#define TRUE 1 //函数执行正确返回1
//串的堆分配存储表示
typedef struct
{
char *ch;
int length;
}String;
//对串的所有操作都可以通过以下五个基本函数实现
void StrInit(String *);//串的初始化...
分类:
其他好文 时间:
2014-05-09 01:25:02
阅读次数:
294
这题wa了很多词,题目本身很简单,把a/b搞反了,半天才检查出来。 1 #include 2
#include 3 #include 4 5 char isPrime[100001]; 6 7 int main() { 8 int i, j, q, p,
maxi, maxj, m...
分类:
其他好文 时间:
2014-05-08 23:55:19
阅读次数:
515
private static String getDefaultPath(){ boolean
isHaveExternalSD = false; String DefaultPath = "/storage/sdcard0"; File
externalSDCard = new File("/st...
分类:
其他好文 时间:
2014-05-08 22:48:26
阅读次数:
332