![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|
|
#1
|
||||
|
||||
|
Seguramente te haz dejado abierto el archivo
ó lo tienes abierto con otra aplicación ó lo abres dos veces ó lo cierras antes de abrirlo ó nunca lo abres ó estas tratando de escribir en un archivo solo lectura ó ... Escribe alguna línea de cómo lo abres y cierras el archivo para que podamos ver dónde está el error. También puedes tomarte unos minutos para corregir faltas de ortografía, poner mayúsculas y minúsculas dónde corresponda, poner un punto cada tanto para separar frases, etc. Hay un miembro en el club que pone en su firma: Cita:
|
|
#2
|
|||
|
|||
|
aqui esta la undiad tipos
Código:
unit Tipos;
interface
uses
Controls;
type
TPeriodoMedicion = (Manhana, Tarde, Noche);
TTipoMedicion = (Diastolica, Sistolica);
TMedicionPresion = record
ValorMedicion: Integer;
PeriodoMedicion : TPeriodoMedicion;
TipoMedicion : TTipoMedicion;
Fecha : TDate;
end;
implementation
end.
Código:
unit U_Datos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Tipos, ComCtrls;
type
TFrm_Datos = class(TForm)
Rdg_presionesart: TRadioGroup;
Label1: TLabel;
Label2: TLabel;
Tcom_estadodeldia: TComboBox;
Edt_ValorPresion: TEdit;
Btn_Guardar: TButton;
DateTimePicker1: TDateTimePicker;
Label3: TLabel;
procedure Rdg_presionesartClick(Sender: TObject);
procedure Btn_GuardarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Datos: TFrm_Datos;
implementation
{$R *.dfm}
procedure TFrm_Datos.Rdg_presionesartClick(Sender: TObject);
begin
if Frm_Datos.Rdg_presionesart.ItemIndex = 0 then
begin
Frm_Datos.Label1.Caption := 'Sistolica:';
end
else
begin
Frm_Datos.Label1.Caption := 'Diastolica:';
end
end;
procedure TFrm_Datos.Btn_GuardarClick(Sender: TObject);
var
LaMedicionPresion : TMedicionPresion;
F : TextFile;
SArchivo: String;
begin
LaMedicionPresion.ValorMedicion := StrToInt(Edt_ValorPresion.text);
LaMedicionPresion.Fecha := self.DateTimePicker1.Date;
if frm_Datos.Rdg_presionesart.ItemIndex = 0 then
begin
LaMedicionPresion.TipoMedicion := Sistolica;
end
else
begin
LaMedicionPresion.TipoMedicion := Diastolica;
end;
if frm_Datos.Tcom_estadodeldia.ItemIndex = 0 then
LaMedicionPresion.PeriodoMedicion := Manhana
else if frm_Datos.Tcom_estadodeldia.ItemIndex = 1 then
LaMedicionPresion.PeriodoMedicion := Tarde
else if frm_Datos.Tcom_estadodeldia.ItemIndex = 2 then
LaMedicionPresion.PeriodoMedicion := Noche;
sArchivo := ExtractFilePath( Application.ExeName ) + 'Registros.txt';
AssignFile(F, 'Registros.txt');
if FileExists( sArchivo ) then
Append( F )
else
begin
Rewrite( F );
// Escribir una linea
Writeln(F, 'Registro Dato Presion');
end;
Writeln(F, '');
Writeln(F, IntToStr(LaMedicionPresion.ValorMedicion) );
if LaMedicionPresion.PeriodoMedicion = Manhana then
Writeln(F, 'Mananha' )
else if LaMedicionPresion.PeriodoMedicion = Tarde then
Writeln(F, 'Tarde' )
else if LaMedicionPresion.PeriodoMedicion = Noche then
Writeln(F, 'Noche' );
if LaMedicionPresion.TipoMedicion = Diastolica then
Writeln(F, 'Diastolica' )
else if LaMedicionPresion.tipoMedicion = Sistolica then
Writeln(F, 'Sistolica' );
Writeln(F, DateToStr(LaMedicionPresion.Fecha ) );
CloseFile(F);
self.Edt_ValorPresion.Clear;
end;
end.
Código:
unit U_Acerca_De;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, tIPOS;
type
TFrm_Acerca_de = class(TForm)
Label1: TLabel;
Image2: TImage;
StaticText1: TStaticText;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Acerca_de: TFrm_Acerca_de;
Numero_datos_A_Analizar: integer;
DatosMedicion : array of TMedicionPresion;
implementation
{$R *.dfm}
procedure TFrm_Acerca_de.FormCreate(Sender: TObject);
var
F : TextFile;
linealeida: String;
begin
assignfile(F, 'registros.txt');
Reset(F);
Readln(F, LineaLeida);
while not Eof(F) do
begin
// Leer las variables X y Y del punto desde el archivo
Readln(F, LineaLeida);
LineaLeida := Trim(LineaLeida);
// Necesito que no me tenga en cuenta los espacios
if Length(LineaLeida) > 0 then
begin
Numero_datos_a_Analizar := Numero_datos_a_Analizar + 1;
// Ingresar a la matriz de puntos
SetLength(DatosMedicion, Numero_datos_a_Analizar);
Datosmedicion[Numero_datos_a_Analizar - 1].ValorMedicion := StrToInt(LineaLeida);
Readln(F, LineaLeida);
LineaLeida := Trim(LineaLeida);
if LineaLeida = 'Mananha' then
Datosmedicion[Numero_datos_a_Analizar - 1].PeriodoMedicion := Manhana
else if LineaLeida = 'Tarde' then
Datosmedicion[Numero_datos_a_Analizar - 1].PeriodoMedicion := Tarde
else if LineaLeida = 'Noche' then
Datosmedicion[Numero_datos_a_Analizar - 1].PeriodoMedicion := Noche;
Readln(F, LineaLeida);
LineaLeida := Trim(LineaLeida);
if LineaLeida = 'Sistolica' then
Datosmedicion[Numero_datos_a_Analizar - 1].TipoMedicion := Sistolica
else if LineaLeida = 'Diastolica' then
Datosmedicion[Numero_datos_a_Analizar - 1].TipoMedicion := Diastolica;
Readln(F, LineaLeida);
LineaLeida := Trim(LineaLeida);
Datosmedicion[Numero_datos_a_Analizar - 1].Fecha := StrToDate(linealeida);
// TTipoMedicion = (Diastolica, Sistolica);
end;
end;
end;
end.
Última edición por jachguate fecha: 28-10-2014 a las 21:05:38. Razón: Añadir la etiqueta [code] |
|
#3
|
|||
|
|||
|
Jeje
Estas tratando de leer un archivo que esta abierto por otro proceso.
|
![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Error al generar instalador con installshield (error 6173) | jangel_ramirezm | Varios | 4 | 09-12-2008 00:07:54 |
| dbexpress Error: unknown error Code '101' | raorre | Conexión con bases de datos | 3 | 13-10-2008 07:53:49 |
| Error General Sql Error lock conflict ...deadlock | Patricio | Varios | 1 | 19-03-2008 14:52:14 |
| error:[Fatal Error] Unit1.pas(7): Unit ZDbcConnection was compiled with a different.. | karaoke | Conexión con bases de datos | 2 | 19-12-2007 10:22:36 |
| ¿Por qué me da este error?Error creating cursor manejador | nuri | SQL | 2 | 01-08-2005 17:30:28 |
|