Delphi Binary/Text File Necessity -


I'm an engineer and not a software programmer, so please seduce my ignorance.

I have written

I have completed this very program.

What I have not completed I

For a digital portfolio, as explained by the following yet:

I call this "real" A text file would be fine even if I want to save the data to a binary file, but I am concerned about having a large data file.

I also want to read this data from a binary / text file so that the data can be displayed using my Delphi application.

I do not think it will be very difficult. I currently save my data in CSV format.

Here is the twist that the binary file should contain data from different sessions initiated by the user of my application.

So when I click, I say, a button called "historical" data, a new window / form will pop up, which will show different session times that I started & amp; After the first time closed, a session will be selected and the data retrieved to display.

Can it be done in a binary file or you can use 2 files: for a "real" data and another that is the time of the session?

My requirement for this method of saving binary data is that I do not have to type in file names and therefore keep track of many data files. For example, thermometer .hst (historical data) and a thermo.idx (index file) file contains all information such as actual temporary data, reading data time, start session & amp; End time etc.

Any useful pointers and hope that more detail in the form of code will be greatly appreciated.

I hope this sample code is not too late to be useful

< (I have added it as another answer so that I can clearly list the code. If this or my previous post answers your question, please click on the reply icon so that I get reputation points .)

Below is some weird code that shows how to read sections in the INI file Find a bigger file name. I've confirmed that it compiles and returns a valid value, but you will need to make sure what you want. There is more to show you this idea ...

Note that if your data is an extension of filenames, then you have to add the code to remove the extension in my sample code: FileName : = ChangeFileExt (filename, '').

  // Call with an open unearned. Next gives the name of the file name, or "if the trouble function GetNextFileName (CONSTIPIEfile: TINIFEEL): string; Const BASE_FILENAME = 'file.'; The INI file will have // ​​sections [File.1], [File.2], ... [File.100], etc. Var section: TStringList; NumericPartAsString: String; NumericPartAsInteger: Integer; Listindex: integer; Largest FileNumberScienceFor: Integer; Start the result: = ''; Section: = TStringList.Create; IniFile.ReadSections (stream); // Ini fills the string list with the names of all the sections in the file if (section.ccount = 0) result: = BASE_FILENAME + '1' and start // Find the largest extension LargestFileNumberSeenSoFar: = -1; List index: = 0; While indexed & lt; = (String list) [ListIndex], for BASE_FILENAME, '', [] string for each string in the list (which is also a file name): // Start. ); // Remove Base filename (NumericPartAsString & lt; & gt; '') Then start NumericPartAsInteger: = StrToIntDef (NumericPartAsString, -1); If (NumericPartAsInteger & gt; largest file numberSeenFor) then the largest file number SeenFar: = NumericPartAsInteger; End; Ink (ListIndex); End; If (LargestFileNumberSeenSoFar> -1) result: = BASE_FILENAME + IntToStr (SeenFar + 1 largest file number); End; Sections.Free; End; {GetNextFileName} Process TForm1.Button1Click (Sender: Tubect); Var Infection: Tinyfil; NewFileName: string; Start IniFile: = Tinifile.Create ('c: \ junk \ ini.ini'); NewFileName: = GetNextFileName (Iniphil); If (NewFileName = '') then ShowMessage ('Error finding new filename') and show message ('new filename' + NewFileName); IniFile.Free; End;  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -