Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4183632
  • 博文数量: 776
  • 博客积分: 13014
  • 博客等级: 上将
  • 技术积分: 10391
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-22 17:00
文章分类

全部博文(776)

文章存档

2015年(55)

2014年(43)

2013年(147)

2012年(20)

2011年(82)

2010年(429)

分类: LINUX

2014-09-12 17:18:22

Comma_analysis.zip

点击(此处)折叠或打开

  1. /* csv */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>

  5. int main (int argc, char* argv[])
  6. {
  7.     char *lps = NULL, *lpe = NULL;
  8.     char value[32];
  9.     int count = 1;
  10.     lpe = lps = argv[1];
  11.     while (lps)
  12.     {
  13.         lps = strchr (lps, ',');
  14.         if (lps)
  15.         {
  16.             memset (value, 0, sizeof (value));
  17.             strncpy (value, lpe, lps - lpe);
  18.             printf ("%s\n", value);
  19.             lps += 1;
  20.             lpe = lps;
  21.         }
  22.     }
  23. }




阅读(1207) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~