Hi, How can I open a file input.txt
with the form and divide its info in differents arrays
__________
n
word
word
word
abcdefgijl
ijklmnñov
wordxvvc
___________
n is a number, that tells me the number of words that follows here
n = 3; i only know the number untill i read it;
How can i save the 3 types of data here into differents arrays
Because i will use them later
1.- n = the number of words = n
2.- word = is an array =arrayword
3.- abcdef... = other array =arraypuzzle
I have this so far
#include<stdio.h>
#include <stdlib.h>
#include<conio.h>
#include<string.h>
#define MAXLEN 15
FILE *Entrada;
FILE *Salida;
void main()
{
int i,n;
char s;
char arreglopalabra[];
char puzzle[];
Entrada=fopen("C:\\TC\\BIN\\input.txt", "r");
Salida=fopen("C:\\TC\\BIN\\output.txt", "w");
if (Entrada==NULL || Salida==NULL)
{
printf("ERROR");
getch();
return;
}
else
{
while(!feof(Entrada))
{
fscanf(Entrada," %d %s ", &n, &arreglopalabra, &puzzle);
fprintf(Salida, " %d %s ", n, arreglopalabra, puzzle);
}
}
clrscr();
printf("\n %d %s", n, palabra);
getch();
fclose(Entrada);
fclose(Salida);
}