AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Filestream - Add a File to an other File
Thema durchsuchen
Ansicht
Themen-Optionen

Filestream - Add a File to an other File

Ein Thema von cdkiller · begonnen am 27. Jul 2004 · letzter Beitrag vom 27. Jul 2004
Antwort Antwort
cdkiller

Registriert seit: 23. Jul 2004
23 Beiträge
 
#1

Filestream - Add a File to an other File

  Alt 27. Jul 2004, 08:38
hy,

i have the following problems. i have a txt and a dll file.

now i want that the dll file will add at the end of the txt file.
i mean that i want to insert a dll file in a txt file at the end.

i have tried it with a filestream. but it doesnt do it what it should.

can someone post a function ?

thanks...
  Mit Zitat antworten Zitat
Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: Filestream - Add a File to an other File

  Alt 27. Jul 2004, 08:40
I got no idea why anyone wants to do, what you want to do, however, you should show us your code and we will be able to help you to fix it

......
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat
cdkiller

Registriert seit: 23. Jul 2004
23 Beiträge
 
#3

Re: Filestream - Add a File to an other File

  Alt 27. Jul 2004, 08:55
okay,

this is my code:

it should add a dll file to an other file.

Delphi-Quellcode:
var
fs,fs2 : TFileStream;
Buffer: Pointer;
Buffer2: Pointer;
filename: string;
begin
if OpenDialog1.Execute then filename := OpenDialog1.FileName;
fs := TFileStream.Create(filename, fmOpenReadWrite);
fs.ReadBuffer(Buffer^,Sizeof(Buffer^));
fs.Seek(0,soFromEnd);

fs2 := TFilestream.Create('sf_wrapper.dll', fmOpenRead);
fs2.ReadBuffer(Buffer2^,Sizeof(Buffer2^));
fs.WriteBuffer(Buffer2^,Sizeof(Buffer2^));

fs.Free;
fs2.Free;
where is the error or can you fix it ?

[edit=sakura] No pushing within 48 hours Mfg, sakura[/edit]
  Mit Zitat antworten Zitat
Benutzerbild von Steve
Steve

Registriert seit: 2. Mär 2004
Ort: Würzburg
730 Beiträge
 
Delphi 2006 Personal
 
#4

Re: Filestream - Add a File to an other File

  Alt 27. Jul 2004, 09:52
Althoug I don't know for what reason you might need this, here's my answer
Zitat von cdkiller:
fs2.ReadBuffer(Buffer2^,Sizeof(Buffer2^)); where is the error or can you fix it ?
What do you expect "Sizeof(Buffer2^)" to be? you should use "FS2.Size" instead of it... I didn't check if this works cause I'd use the function "CopyFrom":
Delphi-Quellcode:
var
  fs,fs2 : TFileStream;
begin
  if OpenDialog1.Execute then
  try
    fs := TFileStream.Create(OpenDialog1.FileName, fmOpenReadWrite);
    fs2 := TFilestream.Create('myDLL.dll', fmOpenRead);
    fs.Seek (fs.Size,soFromBeginning);
    fs2.Seek(0, soFromBeginning);
    fs.CopyFrom(fs2,fs2.Size);
  finally
    fs.Free;
    fs2.Free;
  end;
end;
(By the way: there were a few 'errors' in your code , e.g. you don't need to read sth. from FS.)

Greetz
Stephan
Stephan B.
Wer andern eine Grube gräbt ist Bauarbeiter!
Wer im Glashaus sitzt, sollte sich lieber im Dunkeln ausziehen!
Außerdem dieser Satz kein Verb...
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#5

Re: Filestream - Add a File to an other File

  Alt 27. Jul 2004, 10:35
Look for my class Hier im Forum suchenTArchive. That's all you need. My class will do all the rest for you.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:37 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz