C言語なら俺に聞け(入門篇) Part 29 at TECH
[2ch|▼Menu]
483:429
08/06/07 16:48:15
>>435-442
遅くなりまして、すみません。長いですがソース↓です。
void hoge(char gyou[512], char *s1, char *s2, char *s3)
{
int cnt;  /* ,の数 */
char *tp;  /* 区切り文字へのポインタ */

cnt = 0;
memset( s1, 0x00, sizeof(s1) );
memset( s2, 0x00, sizeof(s2) );
memset( s3, 0x00, sizeof(s3) );

  tp = strtok( gyou, "," );
  while( tp != NULL ){
    tp = strtok( NULL, "," );
    if ( tp != NULL && cnt == 2 ){
      strcpy( s1, tp );
      printf("hogeの中のs1の値:%s",s1);
    }else if( tp != NULL && cnt == 3 ){
      strcpy( s2, tp );
      printf("hogeの中のs2の値:%s",s2);
    }else if( tp != NULL && cnt == 5 ){
      strcpy( s3, tp );
      printf("hogeの中のs3の値:%s",s3);
    }
    cnt++;
  }
}


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5031日前に更新/203 KB
担当:undef