Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Greg Newsgroups: it.comp.lang.visual-basic Subject: Re: funzione Dir Date: Thu, 08 Oct 2015 23:48:45 +0200 Organization: news.solani.org Lines: 36 Message-ID: References: <4cbc1bla3674309egh2l25i74tbvfiiqm8@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit X-Trace: solani.org 1444340931 26279 eJwNyskRACEIBMCUluUawhFx8g9Bq/rZriGx08LDnM5OPVIPAGEYUwfrA+qsUdawO/v3raH18gUarBEm (8 Oct 2015 21:48:51 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 8 Oct 2015 21:48:51 +0000 (UTC) X-User-ID: eJwFwYEBwCAIA7CXhpbKzsGy/n/CktwM6oBJpNNdqHhm+opovcxYF15C+EZ8YxW7dAi1Z/8p2xHm X-Newsreader: MesNews/1.08.03.00-it Cancel-Lock: sha1:n2XrpNp+QKBF9ZC/nVQXRIcQwiU= X-NNTP-Posting-Host: eJwFwQkBwDAIA0BLfCFDDivFv4TewVPzMBIZWGyLiiGHkOi5cOjquKU3y3ZqD1u+ml8uoXwKSRCa Xref: csiph.com it.comp.lang.visual-basic:18538 Il 08/10/15 23.26.31 salclem2 ha scritto: > "salclem2" nel suo ultimo post si è così espresso: >> "Greg" nel suo ultimo post si è così espresso: >> >>> >>>> x& = GetFileAttributes ("G:\miofile.txt") >>> >>>> If x& > 0 Then MsgBox ("ESISTE") >>> >>> Grazie, alla fine ho usato la funzione Api e va tutto bene, ma vorrei capire perchè non >>> funziona la Dir$ e la Dir >>> Ho provato a riscriverla cosi: >>> >>> Dim aa As String >>> aa = Dir$("c:\prova.txt") >>> e restituisce "prova.txt" >>> >>> mentre: >>> aa = Dir$("h:\prova.txt") >>> da errore 52 numero o nome di file non valido >>> >>> -- Greg >>> >> Il motivo è semplice, perché esiste il drive H: ma non esiste il file, però se entrambi non >> esistono restituisce una stringa vuota. > Anzi, non proprio non esiste, non è accessibile il drive (es. il cdrom), altrimenti restituisce > una stringa vuota. Ma hai ragione, che sbadato. A furia di non usare più il cd-rom mi ero dimenticato che esistesse. Invece il drive H: è li, vuoto ma è li. Quindi la Dir$ può dare 3 risultati, non due! Grazie davvero -- Greg