|
Generated by UTF-8 version of diff2html.pl © Yves Bailly, MandrakeSoft S.A. 2001, Ryohei Morita 2007 diff2html.pl is licensed under the GNU GPL. |
../10-01/10-01-MainFunction.c | 10-02-MainFunction.c | |||
---|---|---|---|---|
39 lines 1268 bytes Last modified : Mon Nov 19 08:32:19 2012 |
37 lines 1237 bytes Last modified : Mon Nov 19 09:50:23 2012 |
|||
1 | // Keisanki Joron 2 (Introduction to Computing II) | 1 | // Keisanki Joron 2 (Introduction to Computing II) | |
2 | // Dept. of Engineering Systems, University of Tsukuba | 2 | // Dept. of Engineering Systems, University of Tsukuba | |
3 | // [UTF-8 / Unix] | 3 | // [UTF-8 / Unix] | |
4 | // 計算機序論2・実習 (筑波大学工学システム学類) | 4 | // 計算機序論2・実習 (筑波大学工学システム学類) | |
5 | 5 | |||
6 | // 2012/11/19a kameda[at]iit.tsukuba.ac.jp | 6 | // 2012/11/19a kameda[at]iit.tsukuba.ac.jp | |
7 | // 10.01. ファイルのオープンとクローズ | 7 | // 10.02. モデルの読込 | |
8 | 8 | |||
9 | #include <stdio.h> | 9 | #include "ic2-ModelHeaders.h" | |
10 | ||||
11 | #define IC2DEFAULTMODEL "ic2_DefaultModel.txt" | |||
12 | int ic2_ReadModel(char *); | |||
13 | 10 | |||
14 | // *********************************************************************** | 11 | // *********************************************************************** | |
15 | // MainFunction ********************************************************** | 12 | // MainFunction ********************************************************** | |
16 | 13 | |||
17 | // +---------------------------------------------------- | 14 | // +---------------------------------------------------- | |
18 | // Main Function | 15 | // Main Function | |
19 | // +---------------------------------------------------- | 16 | // +---------------------------------------------------- | |
20 | int main (int argc, char *argv[]) { | 17 | int main (int argc, char *argv[]) { | |
21 | char *modelfilenameptr = NULL; | 18 | char *modelfilenameptr = NULL; | |
22 | int numberofpatches = 0; | 19 | int numberofpatches = 0; | |
20 | struct ic2PATCH *firstpatchptr = NULL; | |||
23 | 21 | |||
24 | // model ファイルの読み込み | 22 | // model ファイルの読み込み | |
25 | if (argc <= 1) { | 23 | if (argc <= 1) { | |
26 | printf("Warning: no model file is specified, \"%s\" is assumed.\n", IC2DEFAULTMODEL); | 24 | printf("Warning: no model file is specified, \"%s\" is assumed.\n", IC2DEFAULTMODEL); | |
27 | modelfilenameptr = IC2DEFAULTMODEL; | 25 | modelfilenameptr = IC2DEFAULTMODEL; | |
28 | } else { | 26 | } else { | |
29 | modelfilenameptr = argv[1]; | 27 | modelfilenameptr = argv[1]; | |
30 | } | 28 | } | |
31 | numberofpatches = ic2_ReadModel(modelfilenameptr); | 29 | numberofpatches = ic2_ReadModel(modelfilenameptr, &firstpatchptr); | |
32 | if (numberofpatches < 0) { | 30 | if (numberofpatches < 0) { | |
33 | printf("Error: invalid model \"%s\", reading failed.\n", modelfilenameptr); | 31 | printf("Error: invalid model \"%s\", reading failed.\n", modelfilenameptr); | |
34 | return 1; | 32 | return 1; | |
35 | } | 33 | } | |
36 | printf("Number of Patches in the model = %d \n", numberofpatches); | 34 | printf("Number of Patches in the model = %d \n", numberofpatches); | |
37 | 35 | |||
38 | return 0; | 36 | return 0; | |
39 | } | 37 | } |