Check if new file is present

  • Follow


I added this to str1.asm to check if new filename exists
but it fails whether date named file is present or not.


there_already:   ; check to make sure that the file with the date format
                 ; isn't already there  

;       mov      dx,offset storage + 2
;       mov      ax,7143h           ; See if file exists
;       int      21h                ; carry flag set if problem
;      jc        short file_there

is_a_path:
       xor      ax,ax
       xor      dx,dx
       mov      ax,7156h                 ; LFN rename file  Win 98 +
       lea      dx, orig_name + 2        ; old name
       lea      di, storage              ; sets the new name
       int      21h

thanks.

0
Reply andrewkennedy2 2/4/2004 5:02:44 AM

Andrew Kennedy wrote:

> I added this to str1.asm to check if new filename exists
> but it fails whether date named file is present or not.
> 
> 
> there_already:   ; check to make sure that the file with the date format
>                  ; isn't already there  
> 
> ;       mov      dx,offset storage + 2
> ;       mov      ax,7143h           ; See if file exists
> ;       int      21h                ; carry flag set if problem
> ;      jc        short file_there

jnc?

What's bl? I suppose you want 0 - that'll only trash cx. Why not 714Eh? 
The need to close the "handle"? How about just checking the return from 
7156h? (I assume it won't rename to an existing name - haven't tried it 
- should return CF and 50h in ax?)

Best,
Frank

P.S. I see you got crossposting working. Good!




0
Reply Frank 2/4/2004 11:32:57 AM


Andrew Kennedy <andrewkennedy2@ev1.net> schreef in berichtnieuws
6e8b2ce.0402032015.3a9b455e@posting.google.com...
> I added this to str1.asm to check if new filename exists
> but it fails whether date named file is present or not.

That's not so good ...  What are the error-codes returned in both
circumstances ?   Maybe they will tell you what the actual problem is.

(thanks for using cross-posting)

Regards,
  Rudy Wieser




0
Reply R 2/4/2004 11:35:29 AM

R.Wieser <rwieser-killthis-@xs4all.nl> schreef in berichtnieuws
4020d742$0$156$e4fe514c@dreader5.news.xs4all.nl...

Hello Andrew,

  I've not yet received a response from you.   Where you able to solve your
problem ?

Regards,
  Rudy Wieser

> Andrew Kennedy <andrewkennedy2@ev1.net> schreef in berichtnieuws
> 6e8b2ce.0402032015.3a9b455e@posting.google.com...
> > I added this to str1.asm to check if new filename exists
> > but it fails whether date named file is present or not.
>
> That's not so good ...  What are the error-codes returned in both
> circumstances ?   Maybe they will tell you what the actual problem is.
>
> (thanks for using cross-posting)
>
> Regards,
>   Rudy Wieser



0
Reply R 2/6/2004 9:23:01 AM

"R.Wieser" <rwieser-killthis-@xs4all.nl> wrote:
>R.Wieser <rwieser-killthis-@xs4all.nl> schreef in berichtnieuws
>4020d742$0$156$e4fe514c@dreader5.news.xs4all.nl...
>
>Hello Andrew,
>
>  I've not yet received a response from you.   Where you able to solve your
>problem ?

I did respond but it was never posted. I don't know if it's my
IP or what. There are just two NGs where this is happening.

I was getting 2 in al for when the file was present. I will
get back to you SOMETIME when and if I get a chance.


Andy



0
Reply andrewkennedy1 2/6/2004 1:49:36 PM

<andrewkennedy1@ev1.net> schreef in berichtnieuws
102762s28pqvpd1@corp.supernews.com...
>
> "R.Wieser" <rwieser-killthis-@xs4all.nl> wrote:
> >R.Wieser <rwieser-killthis-@xs4all.nl> schreef in berichtnieuws
> >4020d742$0$156$e4fe514c@dreader5.news.xs4all.nl...
> >
> >Hello Andrew,
> >
> >  I've not yet received a response from you.   Where you
> > able to solve your problem ?
>
> I did respond but it was never posted. I don't know if it's my
> IP or what. There are just two NGs where this is happening.

I'm sorry to hear that.

> I was getting 2 in al for when the file was present. I will
> get back to you SOMETIME when and if I get a chance.

You do know what error-code 0002h (in AX, not AL :-) means, do you ?   It
means "File is not found".

It probably means that you *think* you are checking for a certain file, but
you are not.  Most probably a wrong filename/path, or even looking for a
hidden file without specifying so.

Regards,
  Rudy Wieser



0
Reply R 2/6/2004 5:42:03 PM

5 Replies
136 Views

(page loaded in 0.044 seconds)

Similiar Articles:













7/12/2012 3:46:10 PM


Reply: