troller Posted March 3, 2015 Share Posted March 3, 2015 Hello..... i would like to know if it is possible to save the debug box's content on a text file... Searched everywhere, still cant find it Thanks in advance for any help Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 4, 2015 Share Posted March 4, 2015 Check Conversion.scar in OSI use in junction with WriteINI if you want to be simple Quote Link to comment Share on other sites More sharing options...
troller Posted March 4, 2015 Author Share Posted March 4, 2015 (edited) still dont get it:( Never worked with includes before......... This is how it works WriteLn((TimeToStr(Time))+' Text Here'); EDIT I found a command "GetReportText"......I can write in it(AddToReport) but when i save it, it is blank...... I use this proc program New; var s: string; x: Integer; begin x := RewriteFile('C:\Debug.txt', false); s := GetReportText; AddToReport(s); WriteFileString(x, s); CloseFile(x); end. However, the file created doesnt contain anything...Am i using GetReportText in wrong way? Edited March 4, 2015 by troller Quote Link to comment Share on other sites More sharing options...
Oort Posted March 4, 2015 Share Posted March 4, 2015 (edited) This is the method I use. I put information I want to write into the Report string. Then I write it to the debug box with writeln(Report) and write it to the Report File with UpdateReport(Report). If you want to keep adding information to it every time you run your program then just remove the Rewrite file call that is run when the file is detected. Program program_name; var Report : String; Done : Boolean; count: integer; const ReportPath = 'C:\{dir path you are using}\Report.txt'; Procedure InitReportFile; var file:integer; begin if not FileExists(ReportPath) then begin // Create the Report File if not there file := Rewritefile(ReportPath, False) closeFile(file); end else // Remove this section begin // Clear the Report File for New Session. // if you want to continue file := Rewritefile(ReportPath, False); // to add to the file each closefile(file); // you run your program end; end; Procedure UpdateReport(str:string); var file:integer; begin //Writes the string sent to it in the Report File with carriage return file := Appendfile(ReportPath, False); WriteFileString(file, str); writeFilestring(file,#13#10); //Starts text on next line (carriage return) CloseFile(file); writeln(str); // Adds Update to Debug window end; begin InitReportFile; ClearDebug; UpdateReport('-----------Begin Session-------------'); UpdateReport(DateToStr(Date)+' '+TimeToStr(Time)); UpdateReport('----------- Version 7 -------------'); count := 0; Repeat Report := 'Count has reached '+inttostr(count); UpdateReport(report) count := count + 1; if count > 15 then Done := True; until Done; end. Edited March 4, 2015 by Oort Quote Link to comment Share on other sites More sharing options...
troller Posted March 6, 2015 Author Share Posted March 6, 2015 Oort that DID work!! Thank you! Quote Link to comment Share on other sites More sharing options...
troller Posted March 8, 2015 Author Share Posted March 8, 2015 any possibility to display runtime errors aswell? Quote Link to comment Share on other sites More sharing options...
Oort Posted March 8, 2015 Share Posted March 8, 2015 I have no experience with that so can't help you there. Sorry. Quote Link to comment Share on other sites More sharing options...