Read from file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Read from file

Peter Bogdanoff
When I use:

read from file tURL until eof

to read from a file on disk, should I expect the <result> to always contain “eof”?

I’m suspecting there could be a a file read error while reading thousands of files and I want to catch that.What should I expect to see in the result when that happens?

Peter Bogdanoff
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Read from file

xtalkprogrammer
This could be a number of strings, such as "file not open for read" or
"file does not exist". There is no special string that indicates a
particular error, e.g. the errors don't all start with "error". You have
to check that the error is unexpected and doesn't contains "eof".

Kind regards,

Mark Schonewille
http://economy-x-talk.com
https://www.facebook.com/marksch

Buy the most extensive book on the
LiveCode language:
http://livecodebeginner.economy-x-talk.com

Op 30-Nov-16 om 01:12 schreef Peter Bogdanoff:

> When I use:
>
> read from file tURL until eof
>
> to read from a file on disk, should I expect the <result> to always contain “eof”?
>
> I’m suspecting there could be a a file read error while reading thousands of files and I want to catch that.What should I expect to see in the result when that happens?
>
> Peter Bogdanoff
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Read from file

Peter Bogdanoff
Thanks, Mark.

So I SHOULD see “eof” and NOT any other message if the file read is successful.

Peter

On Nov 29, 2016, at 4:26 PM, Mark Schonewille <[hidden email]> wrote:

> This could be a number of strings, such as "file not open for read" or "file does not exist". There is no special string that indicates a particular error, e.g. the errors don't all start with "error". You have to check that the error is unexpected and doesn't contains "eof".
>
> Kind regards,
>
> Mark Schonewille
> http://economy-x-talk.com
> https://www.facebook.com/marksch
>
> Buy the most extensive book on the
> LiveCode language:
> http://livecodebeginner.economy-x-talk.com
>
> Op 30-Nov-16 om 01:12 schreef Peter Bogdanoff:
>> When I use:
>>
>> read from file tURL until eof
>>
>> to read from a file on disk, should I expect the <result> to always contain “eof”?
>>
>> I’m suspecting there could be a a file read error while reading thousands of files and I want to catch that.What should I expect to see in the result when that happens?
>>
>> Peter Bogdanoff
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Read from file

Bob Sneidar-2
Only if you read the whole file. The result should be empty if you only read part of the file (I may be mistaken). If you expect the entire file is not too big to load completely into memory, it's probably better to read the whole thing (read from tFile until EOF) then parse it. Otherwise it may be better to read in chunks.

Bob S


> On Nov 29, 2016, at 16:45 , Peter Bogdanoff <[hidden email]> wrote:
>
> Thanks, Mark.
>
> So I SHOULD see “eof” and NOT any other message if the file read is successful.
>
> Peter
>
> On Nov 29, 2016, at 4:26 PM, Mark Schonewille <[hidden email]> wrote:
>
>> This could be a number of strings, such as "file not open for read" or "file does not exist". There is no special string that indicates a particular error, e.g. the errors don't all start with "error". You have to check that the error is unexpected and doesn't contains "eof".
>>
>> Kind regards,
>>
>> Mark Schonewille
>> http://economy-x-talk.com
>> https://www.facebook.com/marksch
>>
>> Buy the most extensive book on the
>> LiveCode language:
>> http://livecodebeginner.economy-x-talk.com
>>
>> Op 30-Nov-16 om 01:12 schreef Peter Bogdanoff:
>>> When I use:
>>>
>>> read from file tURL until eof
>>>
>>> to read from a file on disk, should I expect the <result> to always contain “eof”?
>>>
>>> I’m suspecting there could be a a file read error while reading thousands of files and I want to catch that.What should I expect to see in the result when that happens?
>>>
>>> Peter Bogdanoff
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode