Forum > Other

[SOLVED] Files on the Amiga

(1/5) > >>

chobani:
When I try and do basic file operations on the Amiga, I get the result file not found. Is there any notation, folder mapping, no file extensions, or case sensitivity I need to know about?  I can compile fine and run on all the other targets, hopefully I just need to know something basic.

I'm not using any kind of folder structure, all the files live in the same directory. Thank you!

Just something like this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  InFile: TextFile; begin     AssignFile(InFile, 'text.txt');      // Open the file for reading    Reset(InFile);     // Keep reading lines until the end of the file is reached    while not Eof(InFile) do    begin      ReadLn(InFile, S);      Write(S);      if Not(Eof(InFile)) then WriteLn;    end; end. 

TRon:

--- Quote from: chobani on February 21, 2023, 01:13:03 pm ---When I try and do basic file operations on the Amiga, I get the result file not found. Is there any notation, folder mapping, no file extensions, or case sensitivity I need to know about?  I can compile fine and run on all the other targets, hopefully I just need to know something basic.

--- End quote ---
Default Amiga used filesystem does not have case sensitive filenames or other special things that you need to be aware of as the RTL should take care of everything automatically for you (path/drive/assign separator conversion etc).

Going by your code I would assume the issue is that you forgot to close the handle. Which means the file is "in use" the second time you try to open it and that might fail. You would have to check IOresult for that.

Edit: an example on how to use IOresult can be found here: https://www.freepascal.org/docs-html/rtl/system/reset.html

chobani:
I appreciate the quick reply, I just typed that up real quick and forgot the close, but I am closing it and I am checking the file result which is why I know it's not finding it.

This is the actual code and what I get is Error file not found [whatever is passed] only on the Amiga, but works on Linux, Windows, etc.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure DisplayFile(AFilename: String);var  InFile: TextFile;  S: String;  Ch: Char;begin  // Set the name of the file that will be read  AssignFile(InFile, AFilename);   // Embed the file handling in a try/except block to handle errors gracefully  try    // Open the file for reading    Reset(InFile);     // Keep reading lines until the end of the file is reached    while not Eof(InFile) do    begin      ReadLn(InFile, S);      Write(S);      if Not(Eof(InFile)) then WriteLn;    end;     // Done so close the file    CloseFile(InFile);  except    on E: EInOutError do    begin      WriteLn('Error reading "' + AFilename + '": ' + E.Message);      WriteLn('Hit a key to continue');      Ch:=ReadKey;    end;  end;end;      

chobani:
It also fails with that result on first call.

TRon:
What happens if you use a fully qualified filename e.g. with drive (or assign):path/filename.extension ?

I do not have my Amiga or emulator around here to be able to check/test atm so unless someone else is able to chime in you would have to wait a at least a day for verification from my hand.

BTW: which exact version of Free Pascal are you using that seems to show this behaviour ?

Navigation

[0] Message Index

[#] Next page

Go to full version