Reading file lazarus / 35-Windows CE ---------------------------------------------------------------------- dario · 2011-10-26 08:55 Hello, i'm on the first application on WinMobile5 emulator. When trying to reading a file "pippo.txt" with this button event: procedure TForm1.Button2Click(Sender: TObject); var t:Tstringlist; filename:String; begin      t := TStringList.create;      filename := ExtractFilePath(Application.ExeName) + 'pippo.txt';      t.LoadFromFile(filename);      ListBox1.items.Text:= t.text;      t.free; end;  i have the error: "Unable to open file \storage card\test 5\pippo.txt" where pippo.txt is the file under the same folder of executable, that is in the emulater storage card , a shared folder on my windows c:\toWinCE where i have the entire test5 lazarus project ... What is wrong on loading the file in this simple manner? Many thanks for help me. Dario ---------------------------------------------------------------------- felipemdc · 2011-10-26 09:37 I have very similar code which works. Are you sure that file is not being used by your program for something else and therefore locked? ---------------------------------------------------------------------- dario · 2011-10-26 10:51 Quote from: felipemdc on October 26, 2011, 11:37:01 amI have very similar code which works. Are you sure that file is not being used by your program for something else and therefore locked? I copy all the project path that was into storage device into a folder of "Program Files" of PocketPC emulated. I run from it and i have the same error, also renaming file. Now i have "Unable to open file "\Program Files\test5\poldo.txt" ... :-( Thanks to help me ... ---------------------------------------------------------------------- felipemdc · 2011-10-26 11:24 I just tested your code here and it works fine. I suppose that either: 1> The file does not exist, you made a typo somewhere or 2> The file is blocked because another process or your own application has opened it ---------------------------------------------------------------------- mas steindorff · 2011-10-26 18:30 Quote from: dario on October 26, 2011, 12:51:23 pmNow i have "Unable to open file "\Program Files\test5\poldo.txt" ... :-( Thanks to help me ... in windows, I beleive you need to include the drive letter for a full path name.  what happens if you just use the file name? ---------------------------------------------------------------------- felipemdc · 2011-10-26 19:48 Quote from: mas steindorff on October 26, 2011, 08:30:28 pmin windows, I beleive you need to include the drive letter for a full path name. Windows CE does not have drive letters. Quotewhat happens if you just use the file name? In my tests it doesn't work. But for me his exact same code works. ---------------------------------------------------------------------- BlueIcaro · 2011-10-26 20:27 If the file is in the same folder than the program, try to load the file without the the full path, like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i t.loadfromfile ('myfile.txt'); May be you have wrong path, for debug purposes, you can use a showmessage dialog to show the filename variable, before call LoadFromFile, so you can see if you have some thing wrong with the path. Also, please tell us what version of Lazarus are you using. /BlueIcaro ---------------------------------------------------------------------- dario · 2011-10-27 07:58 I use Lazarus 0.9.30. Also trying to do t.loadfromfile('pippo.txt') don't works. I really don't understand. Putting a TFilelistbox on my form and running into mobile emulator, it gives: [GetCurrentDirWide ... the concept of current directory dosn't exists in Windows CE on the ... there is OK button and i dont' read what is under it ... :-( help me ... Dario ---------------------------------------------------------------------- felipemdc · 2011-10-27 08:12 Quote from: dario on October 27, 2011, 09:58:37 amAlso trying to do t.loadfromfile('pippo.txt') don't works. I really don't understand. It is normal that it doesn't work, just like the message you just quoted, "the concept of current directory dosn't exists in Windows CE". The Path must be always full. What surprises me is that the original code doesn't work for you: procedure TForm1.Button2Click(Sender: TObject); var t:Tstringlist; filename:String; begin      t := TStringList.create;      filename := ExtractFilePath(Application.ExeName) + 'pippo.txt';      t.LoadFromFile(filename);      ListBox1.items.Text:= t.text;      t.free; end; It works fine for me. Questions: 1> Does your application contain only that? It not, could you create an app with only that and see if it works? Just 1 button and that code. 2> Are you using the emulators recomended by the wiki? QuotePutting a TFilelistbox on my form and running into mobile emulator, it gives: [GetCurrentDirWide ... the concept of current directory dosn't exists in Windows CE on the ... there is OK button and i dont' read what is under it ... I think this error is fixed in Lazarus 0.9.31+ ---------------------------------------------------------------------- dario · 2011-10-27 08:17 It could't be a more stupid error! File was "pippo.txt.txt", but it apperas as "pippo.txt" in windows and also in wince. Sorry everybody! Was very stupid error, because i was on the first time on wince and use a new virtual machine with installed Lazarus, i didn't remember the extention option display of windows folder ...   Many thanks to us to help me boys. I am on delphi from a lot of time (this is our italian erp http://www.archimede.net/eureka_video.html that i develop) ... this of dont' be able to load a file in wince was really incredible ... i shot my head on wall a lot of time yesterday ... Ok the next step is how swap file from windows to wince programmatically, but i will open another post. Dario