Newsgroups: fj.lang.c
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!newsgate1.web.ad.jp!infoweb-news!news.fukuoka.infoweb.or.jp!newshost.ryukyu.ad.jp!sour!merope!void
From: void@merope.opus.or.jp (Kusakabe Youichi)
Subject: Re: =?ISO-2022-JP?B?GyRCI00jUyNDJE48QUxkIUolVSUhJSQlayVdJSQlcyU/GyhC?=
Message-ID: <1997Jan29.122517.5823@merope.opus.or.jp>
Organization: Macintosh User Group PLEIADES in opus
X-Newsreader: TIN [version 1.2 PL0]
References: <1997Jan29.055747.8025@fujikoshi.co.jp>
Date: Wed, 29 Jan 1997 12:25:17 GMT
Lines: 99
Xref: galaxy.trc.rwcp.or.jp fj.lang.c:3552
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.lang.c&nb=3552&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

Yasuharu Simazaki (simazaki@fjyisl.fujikoshi.co.jp) wrote:
: MSCV4$B$G(B,$B%U%!%$%k$N%]%$%s%?!<$rJQ?t$G%5%V4X?t$KEO$9J}K!65$($F$/$@$5$$(B.

$B!V(BFILE *$B!W7?$N0z?t$GEO$;$P$o$?$j$^$9!#(B

/*
 * foo.h
 */
int sub_print(FILE *);
int sub_scan(FILE *, FILE *);

/*
 * fpr01.c
 * $B%U%!%$%k(BI/O $B$r(B $B%5%V4X?t$G9T$&(B
 * $B%U%!%$%k%]%$%s%?!<$r4X?t0z?t$K$9$k(B
 */
#include <stdio.h>
#include "foo.h"

char name[20];
int val;

main()
{
char inpfile1[] = "abci.txt";/* $BF~NO%U%!%$%k(B  $BF0J*(B */
char inpfile2[] = "abci2.txt";/* $BF~NO%U%!%$%k(B2 $BD;(B sub */
char outfile1[] = "abco.txt";/* $B=PNO%U%!%$%k(B */
char outfile2[] = "abco2.txt";/* $B=PNO%U%!%$%k(B2    sub */
FILE *ifp1, *ifp2;
FILE *ofp1, *ofp2;

if ((ifp1 = fopen(inpfile1, "r")) == NULL) {
fprintf(stdout, "input 1 error\n");
exit(1);
}
if ((ifp2 = fopen(inpfile2, "r")) == NULL) {
fprintf(stdout, "input 2 error\n");
exit(1);
}
if ((ofp1 = fopen(outfile1, "w")) == NULL) {
fprintf(stdout, "output 1 error\n");
exit(1);
}
if ((ofp2 = fopen(outfile2, "w")) == NULL) {
fprintf(stdout, "output 2 error\n");
exit(1);
}

while(fscanf(ifp1, "%s%d",name, &n) != EOF) {
fprintf(stdout, "%20s %3d\n", name, val);
fprintf(ofp1, "%20s %3d\n", name, val);
sub_print(ofp2);
}
sub_scan(ifp2, stdout);

fclose(ifp1);
fclose(ifp2);
fclose(ofp1);
fclose(ofp2);
return (0);
}

/*
 * subfp.c
 */
#include <stdio.h>

extern char name[];
extern int val;

int sub_print(FILE *fp)
{
fprintf(fp, "%20s %3d\n", name, val);
return (0);
}

/*
 * subfs.c
 */
#include <stdio.h>

extern char name[];
extern int val;

int sub_scan(FILE *ifp, FILE *ofp)
{
while (!feof(ifp)) {
fscanf(ifp, "%s%d",name, &val);
fprintf(ofp, "%s %3d\n",name, val);
}
return(0);
}

// $B@5$7$/F0:n$9$k$+$I$&$+$^$G$OJ]>Z$7$^$;$s$,(B ;-P

  $B%X(B_$B%X(B   ------------------------
$B%_!&!&(B $B%_(B  void@merope.opus.or.jp
 (  $B!k(B )$B!A(B            $BF|2<ItM[0l(B
----------------------------------
