strncpy()関数の使い方の確認なのですが 下記の使い方で
うまくいく場合と行かない場合があります。
ファイルから1行読み込み、2桁の数字、5桁の数字、12桁の英数文字
を抜き取る作業なのですが関数の使い方は合っているでしょうか?
----------------------------------------
FILE *fp;
int a, b;
char str0[256];
char str1[256];

fp = fopen ("M:\\test\\data1.txt", "r");
if (fp == NULL) exit (-1);
while (fscanf (fp, "%s", str0) != EOF) {

strncpy (str1, str0, 2);
a = atoi (str1);
strncpy (str1, str0 + 3, 5);
b = atoi (str1);
strncpy (str1, str0 + 9, 12);

keisan1 (hwnd, a, b, str1);
}
fclose (fp);
---------------------------------------
データファイルの中身
01,23456,abc456ghijkl
52,63481,vwxyz.abcdef
       :
       :