Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Prism öffnen von binary-Dateien (C++) mit Delphi (https://www.delphipraxis.net/93072-oeffnen-von-binary-dateien-c-mit-delphi.html)

kalle1 31. Mai 2007 10:17


öffnen von binary-Dateien (C++) mit Delphi
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo,

ich habe vor ein bereits bestehendes System mit Hilfe von Delphi 2005 zu erweitern.
Das Problem ist, dass hierfür mit C++ abgespeicherte binary-Dateien von Delphi
geöffnet werden müssen. Der Source Code in C zum Öffnen dieser Datei ist folgender:


// martin3.cpp : Defines the entry point for the console application.

#include "stdafx.h"

#include <cstdlib>
#include <iostream>
#include <fstream>
#ifndef TtypesH
#define TtypesH
using namespace std;

int s;

int main(int argc, char* argv)
{
// values are in Filename with ending ".001"
typedef struct MeasureHeader
{
unsigned int MeasureCount;
//unsigned char SystemCount;
char LackNr[5];
char Karosse[3];
unsigned char Ort;
char FileNamePart[19];

} t_MeasureHeader;


// values are in Filename with ending ".001"
typedef struct TabMeasure
{
unsigned int ID;
double StartTime;
double EndTime;
double Result; // dE wert
unsigned char Output; // 1=IO 2=NIO 3=NoC
unsigned char SysCount;
__int64 StartPos_TabSystem[6]; // max. 6 Systeme d.h. 6 Kameras
} t_TabMeasure;

#endif

//----Daten ausgeben---------------------------------------------------------------------------

ifstream file("001", ios::binary);

{if(!file) {cerr <<"Fehler beim Oeffnen der Datei \n"<< argv[1]
<<endl; system("PAUSE"); return 2;}}
// Datei geladen

t_TabMeasure col;

for (s = 0; s < 10; s++) { // Die ersten 10 Datensätze ausgeben

file.read( ( char* )&col, sizeof(t_TabMeasure));

cout << col.ID << " : " << col.StartTime << " : " << col.EndTime;
printf("\n\n");

}
system("PAUSE");

return 0;
}


Ist es möglich die Datei in Delphi zu öffnen, wenn ja, wie?
Die zu öffnede Datei habe ich gepackt und angehängt.

mkinzler 31. Mai 2007 10:25

Re: öffnen von binary-Dateien (C++) mit Delphi
 
Delphi-Quellcode:
TabMeasure = Record
    ID: Cardinal;
    StartTime: Double; {oder TDateTime?}
    EndTime: Double;
    Result: Double;
    Output: Byte; // 1=IO 2=NIO 3=NoC
    Byte: SysCount;
    StartPos_TabSystem: Array[1..6] of Int64; // max. 6 Systeme d.h. 6 Kameras
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:18 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