×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

HOW TO CHECK IF A FILE EXISTS AND IS ALREADY FINISHED

HOW TO CHECK IF A FILE EXISTS AND IS ALREADY FINISHED

HOW TO CHECK IF A FILE EXISTS AND IS ALREADY FINISHED

(OP)
Godd Morning!!!bigsmile

I have a simple situation but my solution is not working good.bugeyed
The situation is that I'm recording a PDF file and I ave to check if it exists (FileExists works OK) AND if it's generation is already finished.... I tried to use FileOpen/FileRead/FileClose but it´s not OK.... This is within a looping cause I have do record more than one file and I can work only one file at a time...

These are my code lines:

...
li_sair = -1
ls_dados = '/' // The first line is a system dateusing 'dd/mm/yyyy'
li_nroarq = FileOpen(ls_arqorigem)
DO WHILE li_sair = -1
li_sair = FileRead(li_nroarq, ls_dados) - // it's returning -1 (error)
LOOP
FileClose(li_nroarq)
...

Any tips?ponder
Thanks in advance...wink

RE: HOW TO CHECK IF A FILE EXISTS AND IS ALREADY FINISHED

From the PowerBuilder help file on 'FileOpen PowerScript Function':

File not found
If PowerBuilder does not find the file, it creates a new file, giving it the specified name,
if the fileaccess argument is set to Write!. If the argument is not set to Write!, FileOpen returns -1.


The default fileaccess is Read! so you may need to change your call to something like:

Fileopen('c:\temp\myfile.txt', StreamMode!, Write!) 

- Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

RE: HOW TO CHECK IF A FILE EXISTS AND IS ALREADY FINISHED

(OP)
Thank You MBALENT for the tip.... But it closed the application.... Did not workout..... So I tried READ! instead and it worked!
Thanks again!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close