2011|08|
2013|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|05|06|07|08|09|10|11|12|
2016|01|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|

2017-05-07 SOEM のLinuxバージョンコンパイルの状態を見る [長年日記]

// SOEM のLinuxバージョンコンパイルの状態を見る 
 
 
ebata@ebata-ethercat:~/Downloads/SOEM-1.3.1$source ./setup.sh linux 
ebata@ebata-ethercat:~/Downloads/SOEM-1.3.1$ make 
 
// 通信ライブラリの作成作業 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/oshw 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/oshw/linux 
--- Compiling nicdrv.c 
--- Compiling oshw.c 
 
--- Create library liboshw.a ← 通信ライブラリの完成 
 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/oshw/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/oshw 
// 通信ライブラリの作成作業完了 
 
// SOEMライブラリの作成作業 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/soem 
--- Compiling ethercatfoe.c 
--- Compiling ethercatmain.c 
--- Compiling ethercatsoe.c 
--- Compiling ethercatdc.c 
--- Compiling ethercatconfig.c 
--- Compiling ethercatprint.c 
--- Compiling ethercatcoe.c 
--- Compiling ethercatbase.c 
 
--- Create library libsoem.a ← SOEMライブラリの完成 
 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/soem 
// SOEMライブラリの作成作業完了 
 
 
 
// タイマー系ライブラリの作成作業 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/osal 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/osal/linux 
--- Compiling osal.c 
osal.c: In function ‘osal_gettimeofday’: 
osal.c:69:54: warning: right-hand operand of comma expression has no effect [-Wunused-value] 
    return_value = clock_gettime(CLOCK_MONOTONIC, &ts), 0; 
                                                      ^ 
--- Create library libosal.a ← タイマー系ライブラリの完成 
 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/osal/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/osal 
// タイマー系ライブラリの作成作業完了 
 
 
// アプリケーション(ebox, eepromtool, read_test, simple_test, slaveinfo)の作成 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/test 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/test/linux 
--- Compiling ebox.c 
--- Linking ebox 
--- Compiling eepromtool.c 
--- Linking eepromtool 
--- Compiling red_test.c 
--- Linking red_test 
--- Compiling simple_test.c 
simple_test.c: In function ‘simpletest’: 
simple_test.c:40:27: warning: variable ‘wkc_count’ set but not used [-Wunused-but-set-variable] 
   int i, j, oloop, iloop, wkc_count, chk; 
                           ^ 
simple_test.c: In function ‘main’: 
simple_test.c:237:7: warning: variable ‘iret1’ set but not used [-Wunused-but-set-variable] 
   int iret1; 
       ^ 
--- Linking simple_test 
--- Compiling slaveinfo.c 
--- Linking slaveinfo 
--- Compiling firm_update.c 
--- Linking firm_update 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/test/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/test 
// アプリケーション(ebox, eepromtool, read_test, simple_test, slaveinfo)の作成作業完了 
 
ebata@ebata-ethercat:~/Downloads/SOEM-1.3.1$ 
 
しかし、このままでは、コンパイルの様子が良く分からないので、 
 
SOEM-1.3.1/make/rules.mkの  
 
============================================ 
$(OBJDIR)/%.o: %.c 
    @echo --- Compiling $< 
#   $(SILENT)$(CC) $(CFLAGS) $(INC_PATHS) -c $< -o $@ ← コメントアウト 
    $(CC) $(CFLAGS) $(INC_PATHS) -c $< -o $@  ← サイレントモードを解除 
============================================SOEM-1.3.1/make/lib.mkの  
 
============================================ 
lib$(LIBNAME).a: $(OBJDIR) $(SUBDIRS) $(OBJDIR_OBJS) 
    @echo --- Create library $@ 
    @test -e $(LIBDIR) || $(MKDIR) $(LIBDIR) 
#   $(SILENT)$(AR) crus $(LIBDIR)/$@ $(OBJDIR)/*.o ← コメントアウト 
    $(AR) crus $(LIBDIR)/$@ $(OBJDIR)/*.o ← サイレントモードを解除 
============================================SOEM-1.3.1/make/app.mkの  
 
============================================ 
$(APPNAME): $(OBJDIR) $(SUBDIRS) $(OBJDIR_OBJS) $(EXTRA_OBJS) 
    @echo --- Linking $@ 
#   $(SILENT)$(CC) $(LDFLAGS) $(LD_PATHS) $(OBJDIR)/*.o -o $@ $(LIBS) ← コメントアウト 
    $(CC) $(LDFLAGS) $(LD_PATHS) $(OBJDIR)/*.o -o $@ $(LIBS) ← サイレントモードを解除 
============================================ 
 
として、コンパイルの様子を表示させてみた。 
 
ebata@ebata-ethercat:~/Downloads/SOEM-1.3.1$ make 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/oshw 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/oshw/linux 
 
--- Compiling nicdrv.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/nicdrv.d" -MT"obj/linux/nicdrv.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c nicdrv.c -o obj/linux/nicdrv.o 
 
--- Compiling oshw.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/oshw.d" -MT"obj/linux/oshw.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c oshw.c -o obj/linux/oshw.o 
 
--- Create library liboshw.a 
/usr/bin/ar crus "/home/ebata/Downloads/SOEM-1.3.1/lib/linux"/liboshw.a ./obj/linux/*.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/oshw/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/oshw 
 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/soem 
 
--- Compiling ethercatfoe.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatfoe.d" -MT"obj/linux/ethercatfoe.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatfoe.c -o obj/linux/ethercatfoe.o 
 
--- Compiling ethercatmain.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatmain.d" -MT"obj/linux/ethercatmain.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatmain.c -o obj/linux/ethercatmain.o 
 
--- Compiling ethercatsoe.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatsoe.d" -MT"obj/linux/ethercatsoe.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatsoe.c -o obj/linux/ethercatsoe.o 
 
--- Compiling ethercatdc.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatdc.d" -MT"obj/linux/ethercatdc.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatdc.c -o obj/linux/ethercatdc.o 
 
--- Compiling ethercatconfig.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatconfig.d" -MT"obj/linux/ethercatconfig.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatconfig.c -o obj/linux/ethercatconfig.o 
 
--- Compiling ethercatprint.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatprint.d" -MT"obj/linux/ethercatprint.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatprint.c -o obj/linux/ethercatprint.o 
 
--- Compiling ethercatcoe.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatcoe.d" -MT"obj/linux/ethercatcoe.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatcoe.c -o obj/linux/ethercatcoe.o 
--- Compiling ethercatbase.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ethercatbase.d" -MT"obj/linux/ethercatbase.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ethercatbase.c -o obj/linux/ethercatbase.o 
 
--- Create library libsoem.a 
/usr/bin/ar crus "/home/ebata/Downloads/SOEM-1.3.1/lib/linux"/libsoem.a ./obj/linux/*.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/soem 
 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/osal 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/osal/linux 
 
--- Compiling osal.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/osal.d" -MT"obj/linux/osal.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c osal.c -o obj/linux/osal.o 
osal.c: In function ‘osal_gettimeofday’: 
osal.c:69:54: warning: right-hand operand of comma expression has no effect [-Wunused-value] 
    return_value = clock_gettime(CLOCK_MONOTONIC, &ts), 0; 
                                                      ^ 
--- Create library libosal.a 
/usr/bin/ar crus "/home/ebata/Downloads/SOEM-1.3.1/lib/linux"/libosal.a ./obj/linux/*.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') 
 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/osal/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/osal 
 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/test 
--- Entering /home/ebata/Downloads/SOEM-1.3.1/test/linux 
 
--- Compiling ebox.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/ebox.d" -MT"obj/linux/ebox.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c ebox.c -o obj/linux/ebox.o 
 
--- Linking ebox 
/usr/bin/gcc -Wl,-Map=ebox.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o ebox -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Compiling eepromtool.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/eepromtool.d" -MT"obj/linux/eepromtool.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c eepromtool.c -o obj/linux/eepromtool.o 
 
--- Linking eepromtool 
/usr/bin/gcc -Wl,-Map=eepromtool.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o eepromtool -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Compiling red_test.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/red_test.d" -MT"obj/linux/red_test.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c red_test.c -o obj/linux/red_test.o 
 
--- Linking red_test 
/usr/bin/gcc -Wl,-Map=red_test.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o red_test -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Compiling simple_test.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/simple_test.d" -MT"obj/linux/simple_test.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c simple_test.c -o obj/linux/simple_test.o 
simple_test.c: In function ‘simpletest’: 
simple_test.c:40:27: warning: variable ‘wkc_count’ set but not used [-Wunused-but-set-variable] 
   int i, j, oloop, iloop, wkc_count, chk; 
                           ^ 
simple_test.c: In function ‘main’: 
simple_test.c:237:7: warning: variable ‘iret1’ set but not used [-Wunused-but-set-variable] 
   int iret1; 
       ^ 
--- Linking simple_test 
/usr/bin/gcc -Wl,-Map=simple_test.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o simple_test -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Compiling slaveinfo.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/slaveinfo.d" -MT"obj/linux/slaveinfo.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c slaveinfo.c -o obj/linux/slaveinfo.o 
 
--- Linking slaveinfo 
/usr/bin/gcc -Wl,-Map=slaveinfo.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o slaveinfo -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Compiling firm_update.c 
/usr/bin/gcc -Wall -Wextra -Wno-unused-parameter  -fomit-frame-pointer -fno-strict-aliasing -B/usr/bin/libexec/gcc  -MMD -MP -MF"obj/linux/firm_update.d" -MT"obj/linux/firm_update.d" -g -O0 -ffunction-sections  -I"/home/ebata/Downloads/SOEM-1.3.1/osal" -I"/home/ebata/Downloads/SOEM-1.3.1/osal/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/oshw/linux" -I"/home/ebata/Downloads/SOEM-1.3.1/soem" -I"/usr/bin/linux/include" -c firm_update.c -o obj/linux/firm_update.o 
 
--- Linking firm_update 
/usr/bin/gcc -Wl,-Map=firm_update.map  -Wl,--gc-sections  -L"/home/ebata/Downloads/SOEM-1.3.1/lib/linux" obj/linux/*.o -o firm_update -Wl,--start-group  -loshw -losal -lsoem -lc -lm -Wl,--end-group -lpthread -lrt 
 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/test/linux 
--- Leaving /home/ebata/Downloads/SOEM-1.3.1/test 
 
これで作成プロセスが全部見えるようになった。 
 
======= 
 
上記のリンクオプションで、"-lrt"というコマンドが出てきている。気になったので、調べてみたら、これは、"Realtime Extensions library"というもので、clock_gettimeなどを使って、ナノ秒単位での分解能が得られるそうである。 
 
 
 
 

2017-05-25 C/C++ で csvファイルの読み込みに、strtokを使うのに疲れた私の為に [長年日記]

/*
  出展 http://simd.jugem.jp/?eid=49
  gcc -g comma.cpp -o comma
 */
 
#include <stdio.h>
 
int main(void)
{
  FILE *fp;
  const char *fname = "comma.csv";
  char s[100];
  int ret, n1, n2;
  float f1, f2;
 
  fp = fopen( fname, "r" );
  if( fp == NULL ){
    printf( "%sファイルが開けません\n", fname );
    return -1;
  }
 
  /*
    fscanf()やscanf()関数には%dや%sなどの、
    変換文字(変換仕様)と言われる指定方法があります。
    その中に、%[^...] という変換文字があり、カッコ内の文字以外を読み込むという意味です。
 
    つまり、%[^abc] の場合は、「abc」以外の文字を読み込むという指定が出来ます。
    これを、CSVファイル読み込みにも利用してみます。
  */
 
  while( ( ret = fscanf( fp, "%[^,],%d,%d,%f,%f", s, &n1, &n2, &f1, &f2 ) ) != EOF ){
    printf( "%s %d %d %f %f", s, n1, n2, f1, f2 );
  }
 
  fclose( fp );
  return 0;
}
 
 
#if 0
 
以下を、"comma.csv"というファイル名で保存する。
 
test01,10,11,1.0,1.1
test02,20,21,2.0,2.1
test03,30,31,3.0,3.1
 
#endif 
 

2017-05-26 mingwでコアダンプができない件 [長年日記]

gdbでrunさせれば、落ちたところで行数が表示される→コアダンプがなくても大丈夫