EvoTalk

Archive for the ‘C++’ Category

24 六月, 2009

AMR Codec

Posted by: asd In: C++| Code Snippet| 程式設計

–AMR-NB–
-    The fixed-point (TS26.073)
-    The float (TS26.104)
-    The specification(TS26.071)
–AMR-WB–
-    The fixed-point (TS26.173)
-    The float (TS26.204)
-    The specification(TS26.171)

3GPP Specification 26-series

19 六月, 2009

C Container Library

Posted by: asd In: C++| Code Snippet| 程式設計

foolib : 用 c 实现了常用的容器,如果 rbtree,hashtable,list,vector,deque,heap,map 以及定时器,os api,应用开发框架。 实现了一个基于 btree 索引算法的文件数据库,提供了断电保护,以及事务提交与回滚等接口
cstl : c 语言编写通用数据结构和常用算法库(模仿 SGI STL)
libscl : Simple, Small Container Library for C

Tags:

18 六月, 2009

UTF8 <->UTF16 C Implement

Posted by: asd In: C++| Code Snippet| 程式設計

參考
UTF-8 与 UTF-16 相互转换及 \uhhhh 转换为 UTF-16 的 C++ 函数(上) 之函数篇
UTF-8 与 UTF-16 相互转换及 \uhhhh 转换为 UTF-16 的 C++ 函数(下) 之使用篇

Tags:

得到目前正在執行的程式路徑,並切換 working directory 至此路徑。
view plain

C:

#include &lt;unistd.h&gt;

 char buf[256] = {'\0'};

 char *pch;

 

readlink("/proc/self/exe", buf, sizeof(buf));

 if (pch = strrchr(buf, '/'))

 {

     *pch = '\0';

      printf("working directory:%s\n", buf);

      chdir(buf);

 }

15 一月, 2009

Replace strtok Function

Posted by: asd In: C++| Code Snippet| 程式設計

strtok is a non-thread safe function
在 unix 平台下有 strtok_r 可替代。
windows 需要實作一個
strtok_r  fnnction, reference General Programming Concepts:
Writing and Debugging Programs
view plain

CODE:

char *strsep(char **stringp, const char *delim)

{

char* strtok_r(char *  s1, const char *  s2,  char **  lasts)

{

  char *ret;

 

  if (s1 == NULL)

    s1 = *lasts;

  while(*s1 &amp;&amp; strchr(s2, *s1))

    ++s1;

  if(*s1 == '\0')

    return NULL;

  ret [...]

Tags:

Page 2 of 2212345...Last »