Forum > Operating Systems

Same Source - different OS - different results. (FileOpen Access Violation WinXP

<< < (2/3) > >>

engkin:
My test is on FPC 3.0.4. Just make sure your file 'testing.123' is not open with another application, or something similar.

ozznixon:
@engkin ... it is something with "create file" even this raises the same error:

(typed off the top of my head, but using old Pascal syntax same error):
Assign(BFH,'testing.456');
Rewrite(BFH,1); <--- Access Violation
Close(BFH);

Again the code works on Linux and Mac, hmmm.

lucamar:
There must be something else wrong in either your program or your system. I've just tested both alternatives in two different machines, with 32 bits Windows XP Home and Professional, with Lazarus/FPC 1.8.4/3.0.4 and they worked as they should.

Also tested in Linux and it also works without more ado.

sash:

--- Quote from: ozznixon on January 30, 2019, 01:45:27 am ---
--- 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";}};} ---Begin   S:='Hello World!';   Handle:=FileCreate('testing.123',2,438);   FileWrite(Handle,@S[1],Length(S));   FileClose(Handle);End.
--- End quote ---

Try not to use relaxing defaults:

  - Check Handle validity
  - Use full path (or explicitly change current directory).

engkin:

--- Quote from: ozznixon on January 30, 2019, 10:21:04 pm ---@engkin ... it is something with "create file" even this raises the same error:

(typed off the top of my head, but using old Pascal syntax same error):
Assign(BFH,'testing.456');
Rewrite(BFH,1); <--- Access Violation
Close(BFH);

Again the code works on Linux and Mac, hmmm.

--- End quote ---

This post contradicts your first post:

--- Quote ---If I change code to use Assign(File,'testing.123'); Rewrite(File,1); etc. works on Windows.
--- End quote ---

My guess: it works, you open the file 'testing.123' or 'testing.456' with some application to check the contents and it blocks access to it, maybe?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version