Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 20-05-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Vamos a ver, sin saber lo que intentas hacer no se si podre ayudarte. Pero aqui te dejo dos ejemplos, puede que saques alguna cosa util de ellos:

En este ejemplo metemos en un stream una cabecera con el tamaño del archivo, y a continuacion el archivo.
Código Delphi [-]
var
  Stream: TMemoryStream;
  Archivo: TFileStream;
  Nombre: string;
  Cabecera: String;
begin
  // Nombre del archivo
  Nombre:= 'd:\Prueba.jpg';
  Stream:= TMemoryStream.Create;
  try
    Archivo:= TFileStream.Create(Nombre,fmOpenRead);
    try
      // En la acbecera vamos a colocar el tamaño del archivo
      Cabecera:= IntToStr(Archivo.Size);
      Stream.WriteBuffer(PChar(Cabecera)^,length(Cabecera)+1);
      // Y cargamos el resto del archivo
      Stream.CopyFrom(Archivo,0);
      // Ahora lo guardamos paar ver el resultado
      Stream.SaveToFile('d:\Archivo.bin');
    finally
      Archivo.Free;
    end;
  finally
    Stream.Free;
  end;
end;

En este otro cargamos un archivo en un stream, extramemos el contenido de la cabecera y a continuacion copiamos el resto del stream en otro stream.
Código Delphi [-]
var
  Stream: TMemoryStream;
  Archivo: TFileStream;
  Cabecera: String;
  Size: Integer;
begin
  // Nombre del archivo
  Stream:= TMemoryStream.Create;
  try
    Stream.LoadFromFile('d:\Archivo.bin');
    Archivo:= TFileStream.Create('d:\Prueba.jpg',fmCreate);
    try
      Cabecera:= String(PChar(Stream.Memory));
      ShowMessage(Cabecera);
      Size:= StrLen(PChar(Stream.Memory))+1;
      Stream.Seek(Size,soFromBeginning);
      Archivo.CopyFrom(Stream,Stream.Size-Size)
    finally
      Archivo.Free;
    end;
  finally
    Stream.Free;
  end;
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
saber bytes que se estan transferiendo Spynosa Internet 0 19-05-2005 11:57:33
4 bytes a un entero ssaavedra Varios 1 09-01-2004 20:12:11
Convertir variable tipo Word a Char andre Varios 2 15-12-2003 20:15:23
Convertir una Variable de String a Integer y Viceversa. aleidania Varios 1 13-07-2003 16:35:37
Cuantos Bytes estoy enviando por FTP? pinoxo Internet 4 27-06-2003 03:05:00


La franja horaria es GMT +2. Ahora son las 20:16:00.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi