var
archDat:text;
archAux:text;
numCamp,i,long,Dato,NumDat:byte;
Tip:char;
begin
Assign(archdat,'datos.txt');
Assign(archaux,'aux.txt');
reWrite(archdat);
reWrite(archaux);
Write('Ingrese el numero de campos :');
ReadLn(NumCamp);
if numcamp>0 then
begin
WriteLn(archdat,numcamp);
for i:=1 to NumCamp do
begin
WriteLn('Ingrese el tipo de dato ,i,: ');
ReadLn(tip);
if UpCase(tip)=upcase('C') then
begin
Write('Ingrese el tamano de la cadena: ');
ReadLn(long);
WriteLn(archdat,ord(upcase('C')));
WriteLn(archdat,long);
end else
if UpCase(tip)=upcase('I') then
begin
Write('Ingrese el numero de bits :');
ReadLn(long);
WriteLn(archdat,ord(upcase('I')));
WriteLn(archdat,long);
end;
end;
end else WriteLn('El numero de campos tiene que ser menor que cero');
WriteLn('Ingrese el numero de datos');
ReadLn(NumDat);
WriteLn('Empiece a ingresar los datos');
for i:=1 to numDat do
begin
ReadLn(Dato);
WriteLn(archaux,Dato);
end;
Close(archdat);
Close(archaux);
end.