Salve, ho la seguente domanda.
Dati due file così composti:
file1:
a b c
d e f

file2:
1 2 3
4 5 6

voglio ottenere un file3:
a b c 1 2 3
d e f 4 5 6

Per ora riesco solo ad allineare parole singole sulla linea, cioè:
a 1
b 2
c 3
d 4
e 5
f 6

Il codice scritto è questo:
codice:
#include <stdio.h>
#include <stdlib.h>


int main ( int argc, char * argv[] )
{
	FILE *fda, *fdb, *fdout;
	char buffa[64], buffb[64], buffer[128];
	int ret;

	if ( argc != 4 ) {
		printf("usare %s file1 file2 outfile\n",argv[0]);
		return 1;
	}

	fda = fopen (argv[1], "r");
	if ( fda == (FILE *) NULL) {
		printf("%s assente\n",argv[1]);
		return 1;
	}
	fdb = fopen (argv[2], "r");
	if ( fdb == (FILE *) NULL) {
		printf("%s assente\n",argv[2]);
		return 1;
	}

	fdout = fopen (argv[3], "a");
	while ( 1 )
	{
		ret = fscanf( fda, "%s", buffa);
		if ( ret != 1 )
			break;
		ret = fscanf( fdb, "%s", buffb);
		if ( ret != 1 )
			break;
		fprintf( fdout ,"%s %s\n", buffa, buffb);
	}

	fclose ( fda);
	fclose ( fdb);
	return 0;
}
Come posso modificarlo?