質問編集履歴
1
フォームの訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,21 +18,29 @@
|
|
18
18
|
|
19
19
|
(改行)
|
20
20
|
|
21
|
+
欲しい実行結果:
|
22
|
+
|
23
|
+
abc
|
24
|
+
|
25
|
+
efg
|
26
|
+
|
27
|
+
hij
|
28
|
+
|
21
29
|
###該当のソースコード
|
22
30
|
|
23
|
-
C言語で記述
|
24
|
-
|
25
|
-
#read_l
|
31
|
+
###read_file.c
|
32
|
+
|
26
|
-
|
33
|
+
```c
|
34
|
+
|
27
|
-
|
35
|
+
#include <stdio.h>
|
28
|
-
|
36
|
+
|
29
|
-
|
37
|
+
#include <stdlib.h>
|
30
|
-
|
38
|
+
|
31
|
-
|
39
|
+
#include <string.h>
|
32
|
-
|
40
|
+
|
33
|
-
|
41
|
+
#include <assert.h>
|
34
|
-
|
42
|
+
|
35
|
-
|
43
|
+
#define ALLOC_SIZE (256)
|
36
44
|
|
37
45
|
|
38
46
|
|
@@ -150,17 +158,19 @@
|
|
150
158
|
|
151
159
|
}
|
152
160
|
|
153
|
-
|
161
|
+
```
|
154
|
-
|
162
|
+
|
155
|
-
#read_line.h
|
163
|
+
###read_line.h
|
164
|
+
|
156
|
-
|
165
|
+
```C
|
166
|
+
|
157
|
-
|
167
|
+
#ifndef READ_LINE_H_INCLUDED
|
158
|
-
|
168
|
+
|
159
|
-
|
169
|
+
#define READ_LINE_H_INCLUDED
|
160
|
-
|
161
|
-
|
162
|
-
|
170
|
+
|
171
|
+
|
172
|
+
|
163
|
-
|
173
|
+
#include <stdio.h>
|
164
174
|
|
165
175
|
|
166
176
|
|
@@ -170,31 +180,31 @@
|
|
170
180
|
|
171
181
|
|
172
182
|
|
173
|
-
|
183
|
+
#endif /* READ_LINE_H_INCLUDED */
|
184
|
+
|
174
|
-
|
185
|
+
```
|
175
|
-
|
176
|
-
|
186
|
+
|
177
|
-
#read_file.c
|
187
|
+
###read_file.c
|
188
|
+
|
178
|
-
|
189
|
+
```C
|
190
|
+
|
179
|
-
|
191
|
+
#include<stdio.h>
|
180
|
-
|
192
|
+
|
181
|
-
|
193
|
+
#include<stdlib.h>
|
182
|
-
|
194
|
+
|
183
|
-
|
195
|
+
#include<assert.h>
|
184
|
-
|
185
|
-
|
186
|
-
|
196
|
+
|
197
|
+
|
198
|
+
|
187
|
-
|
199
|
+
#define ALLOC_SIZE (256)
|
188
|
-
|
189
|
-
|
190
|
-
|
200
|
+
|
201
|
+
|
202
|
+
|
191
|
-
|
203
|
+
#include "read_line.h"
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
204
|
+
|
196
|
-
|
205
|
+
|
206
|
+
|
197
|
-
char *
|
207
|
+
char **add_line(char **text_data, char *line, int *line_alloc_num, int *line_num)
|
198
208
|
|
199
209
|
{
|
200
210
|
|
@@ -220,9 +230,7 @@
|
|
220
230
|
|
221
231
|
|
222
232
|
|
223
|
-
//このフォーム内では* *と書いてますが、実際はスペースを除いて書いてます
|
224
|
-
|
225
|
-
char *
|
233
|
+
char **read_file(FILE *fp, int *line_num_p)
|
226
234
|
|
227
235
|
{
|
228
236
|
|
@@ -282,7 +290,7 @@
|
|
282
290
|
|
283
291
|
}
|
284
292
|
|
285
|
-
|
293
|
+
```
|
286
294
|
|
287
295
|
###試したこと
|
288
296
|
|