Search the Community
Showing results for tags 'file'.
Found 3 results
-
Hello, I have recently installed and registered C++ builder CE, my first test program is not behaving correctly. It's a trivial C++ program, the file open fails. There is nothing that I can see that is incorrect, I've coded with files for decades. Any suggestions appreciated. #include <iostream> #include <fstream> #include <conio.h> #include <tchar.h> using namespace std ; ifstream ifs ; int _tmain(int argc, _TCHAR* argv[]) { ifs.open ("C:\\Junk\\testfile.txt") ; if (!ifs.good()) // ** Also tried if (!ifs) { cout << "Can't open input file.\n"; while (!kbhit()) ; return 1 ; } cout << "Opened OK\n" ; ifs.close() ; while (!kbhit()) ; return 0 ; }
-
Hello. I'm workin with Delphi 10.4.2 community in Windows 10/11. I've this procedure procedure TfrmMain.AddLog(NomeProc, PointProc, Datis: string; MarckEX: boolean); var ErrorLogFileName : string; ErrorFile : TextFile; markec : string; begin ErrorLogFileName := ExtractFilePath(ParamStr(0))+'error.log'; AssignFile(ErrorFile, ErrorLogFileName) ; if FileExists(ErrorLogFileName) then Append(ErrorFile) else Rewrite(ErrorFile) ; try if MarckEX then begin markec := '***;'; end else begin markec := '---;' end; ErrorData := DateTimeToStr(Now) + ';' + NomeProc + ';' + PointProc + ';' + Datis + ';' + markec; WriteLn(ErrorFile,ErrorData) ; finally CloseFile(ErrorFile) end; end; And I've this Task (simple method to work in another thread) called in a button click TASK := TTask.Create( procedure begin //do some work and then.... call AddLog.. AddLog('Test','Test','Test',false); end ); TASK.Start(); If I call AddLog into TASK do not work. I tried to call AddLog in and out to TASK := TTask.Create( procedure begin //do some work and then.... call AddLog.. TThread.Synchronize(nil, procedure begin AddLog('Test','Test','Test',false); end ); end ); TASK.Start(); but without success, nothing is ever written to the file. What am I doing wrong?
-
Hi! I know the code from Jim to open URLs, for example, but I am more looking for something like ShellExecute on Windows but cross platform. Any ideas? Thanks!