NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: osquiabro on February 17, 2020, 05:31:08 AM

Title: Open File Question
Post by: osquiabro on February 17, 2020, 05:31:08 AM
what is a best method in NT for open a File? p web.OpenFile(myfile) or Access:myfile.Open with Access:myfile.UseFile(), what is a difference if any issue?

Thanks..
Title: Re: Open File Question
Post by: DonRidley on February 17, 2020, 05:51:35 AM
I try to use the p_web methods whenever possible.  However, I don't think it matters in the grand scheme of things.

p_web.OpenFile(SomeFile) is simply a call to Open(SomeFile,AccessMode) with error checking.

Don
Title: Re: Open File Question
Post by: Jane on February 17, 2020, 09:12:03 AM
There's a bit of explanation here https://www.capesoft.com/docs/NetTalk11/NetTalk8Upgrade.htm#FileMethods


Jane
Title: Re: Open File Question
Post by: Bruce on February 17, 2020, 11:03:06 PM
hah - was in the docs - thanks Jane :)

Personally I use the ABC methods directly in my own programs.

cheers
Bruce
Title: Re: Open File Question
Post by: DonRidley on February 18, 2020, 02:29:53 AM
There's a bit of explanation here https://www.capesoft.com/docs/NetTalk11/NetTalk8Upgrade.htm#FileMethods


Jane

Nice one Jane!! 
Title: Re: Open File Question
Post by: osquiabro on June 19, 2022, 04:06:24 AM
ok this post is old but again another question about this

Quote
"there is a slight performance gain when using the ABC file methods over the p_web methods."

why NT use a old code for this??
Title: Re: Open File Question
Post by: Bruce on June 19, 2022, 11:24:30 PM
I'm not sure what you mean by "old code"?

The NetTalk templates generate calls to p_wem.OpenFile etc, and that in turn uses Access: methods if the program is ABC and regular Clarion calls for Legacy.

Cheers
Bruce
Title: Re: Open File Question
Post by: osquiabro on June 20, 2022, 03:22:35 AM
i'm confused with this:

"Note that it is perfectly ok for you to use normal ABC file handling methods in your own hand-code. The file methods are included in the class to cater for non-ABC programs. there is a slight performance gain when using the ABC file methods over the p_web methods."

and OPEN(p_File,42h) in netweb.clw
Title: Re: Open File Question
Post by: Bruce on June 20, 2022, 09:20:01 PM
ABC code is generated into WebHandler procedure. So see the OpenFile method in there - that will likely clear up your confusion.
The code in WebHander is the "derived class" - so overrides the code in netweb.clw (or supplements it if the parent method is called.)

Title: Re: Open File Question
Post by: osquiabro on June 21, 2022, 03:29:09 AM
Thanks!