Pascal/Turbo Pascal - registro de datos

 
Vista:
Imágen de perfil de Nahuel

registro de datos

Publicado por Nahuel (2 intervenciones) el 09/10/2014 04:51:20
buenas!! espero que me den una mano en este programa porque estoy en el hornoo

programa que permita agregar un registro de datos de una imagen, cada registro debe tener un codigo (ingresado por el usuario) con el cual el usuario podria o borrar o buscar el registro.

tenia pensado usar un arreglo de registro, pero no tengo idea de como agregar el codigo para cada registro y de como filtrar formatos que no sean de imagenes

si me tiran una mano sadria mas o menos como arrancar con el programa :)

desde ya muchisimas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

registro de datos

Publicado por ramon (2158 intervenciones) el 09/10/2014 20:07:44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{A ver si esto te ayuda}
 
program registro;
  uses
     crt;
   type
      datoimagen = record
             idenbmp : array[0..1] of char;
             tamanobmp : longint;
             reserva1  : word;
             reserva2  : word;
             inicioimag : longint;
             tamanocabe : longint;
             tamanox    : longint;
             tamanoy    : longint;
             planoscolor : word;
             bitspixel   : word;
             compresion  : longint;
             tamaimagen  : longint;
             resolucionx : longint;
             resoluciony : longint;
             numerocolor : longint;
             coloresimpo : longint;
             infor       : longint;
             codigo : longint;
          end;
   var
     regdato : file of datoimagen;
     dato : datoimagen;
 
   procedure guarda_datos_imagen(d : datoimagen);
   begin
      assign(regdato,'datimage.img');
   {$I-} reset(regdato); {$I+}
   if ioresult <> 0 then
   begin
       rewrite(regdato);
       seek(regdato,0);
       write(regdato,d);
       close(regdato);
   end
 else
    begin
       seek(regdato,filesize(regdato));
       write(regdato,d);
       close(regdato);
    end;
   end;
 
   procedure tomada_datos;
   var
     bytes_per_raster : longint;
     raster_pad : integer;
     x, y, x1, y1 : longint;
     l : Byte;
     intx, inty : longint;
     da : datoimagen;
   begin
      fillchar(da,sizeof(da),0);
      x := 10;
      x1 := 200;
      y := 4;
      y1 := 100;
      bytes_per_raster := (X1 - X + 1) * 3;
      if bytes_per_raster mod 4 = 0 then
        raster_pad := 0
      else
        raster_pad := 4 - (bytes_per_raster mod 4) ;
      bytes_per_raster := bytes_per_raster + raster_pad;
      da.idenbmp[0] := 'B';
      da.idenbmp[1] := 'M';
      da.reserva1 := 0;
      da.reserva2 := 0;
      da.inicioimag := 0;
      da.tamanocabe := 14;
      da.tamanox := x;
      da.tamanoy := y;
      da.planoscolor := 1;
      da.bitspixel := 24;
      da.compresion := 0;
      da.tamaimagen := bytes_per_raster * da.tamanox;
      da.resolucionx := 0;
      da.resoluciony := 0;
      da.numerocolor := 0;
      da.coloresimpo := 0;
      da.infor := 40;
      da.codigo := 2714;
      guarda_datos_imagen(da);
   end;
 
   procedure presenta_datos;
   var
     i, codi : longint;
     f : file of datoimagen;
     encont : boolean;
   begin
      clrscr;
      writeln('  ***** Presentacion Datos Por Codigo ****');
      writeln;
      write('   Entre Codigo : ');
      readln(codi);
      encont := false;
      assign(f,'datimage.img');
   {$I-} reset(f); {$I+}
   if ioresult <> 0 then
   begin
      writeln('  Error De Archivo O No Existe Pulse Una Tecla');
      readkey;
   end
  else
     begin
        for i := 0 to filesize(f) - 1 do
        begin
        seek(f,i);
        read(f,dato);
        if dato.codigo = codi then
        begin
           encont := true;
           break;
        end;
      end;
       if encont = true then
       begin
          clrscr;
          writeln('  **** Los Datos Del Codigo Entrado Son ****');
          writeln;
          writeln('  Codigo             : ',dato.codigo);
          writeln('  Iden 1             : ',dato.idenbmp[0]);
          writeln('  Iden 2             : ',dato.idenbmp[1]);
          writeln('  Reservado          : ',dato.reserva1);
          writeln('  Reservado          : ',dato.reserva2);
          writeln('  Tama¤o Cavecera    : ',dato.tamanocabe);
          writeln('  Tama¤o X           : ',dato.tamanox);
          writeln('  Tama¤o Y           : ',dato.tamanoy);
          writeln('  Plano Color        : ',dato.planoscolor);
          writeln('  Bit Por Pixel      : ',dato.bitspixel);
          writeln('  Compresion         : ',dato.compresion);
          writeln('  Tama¤o image       : ',dato.tamaimagen);
          writeln('  X Pixel Metro      : ',dato.resolucionx);
          writeln('  Y Pixel Metro      : ',dato.resoluciony);
          writeln('  Colores usad.      : ',dato.numerocolor);
          writeln('  Colores Imp.       : ',dato.coloresimpo);
          writeln('  Tama¤o Informacion : ',dato.infor);
          writeln('  Total Cavecera Y Informacion = ',
                     sizeof(datoimagen) - 8,' Bytes');
          writeln;
          writeln('    Pulse Una Tecla ');
          readkey;
       end
     else
        begin
          clrscr;
          writeln('   Error Codigo No Encontrado Pulse Una Tecla ');
          readkey;
        end;
     end;
   end;
 
 
  begin
      tomada_datos; {Esto tendrias que realizerlo con entrada manual o}
                    {por Cartura de los datos corresponde a un BMP}
      presenta_datos; {Recojo datos del archivo y los presento}
      erase(regdato); {Borro Archivo}
                      {Esto Es un Ejemplo normal mente no es asi
                       las imagenes se cargan con blockread y no
                       con seek y read estos archivos suelen tener
                       toda la informacion y imagen y son uno solo}
  end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar