Announcement

Collapse
No announcement yet.

lfn example

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • lfn example

    I cant connect to these ... http://www.engr.ucdavis.edu/~mkkim/c...s/lfn/lfn.html and http://magic.hurrah.com/~sabre/os/S3...s/VFATInfo.txt


    ... and these ... http://www.basicguru.com/files/abc/abc9809/pblfn322.bas http://www.basicguru.com/files/abc/abc9703/pblfn32.bas

    Give me ...
    '===========================================================================
    ' Subject: PB LONG FILENAME LIBRARY V2.0 Date: 07-12-98 (12:33)
    ' Author: Hans Lunsing Code: PB
    ' Origin: [email protected] Packet: PB.ABC
    '===========================================================================
    DEFINT A-Z <http://www.powerbasic.com/support/forums/biggrin.gif> IM SHARED K,S,B&,Z&:V1 'Created by PostIt! 7.2
    SUB V1:OPEN "O",1,"PBLFN322.ZIP",4^6:Z&=16751:?STRING$(50,177);
    U"%up()%9%%%d-%\+e2Fkr>yI/%7%%^%%%%0%%%%kn.qj.n%iSine)0?k+nDX[+wA
    U"nR:vwET%zMRsmz-HE],YzAHBHp&=mDEn?^^CpBErR%HAE(x[Mw-A#TtRA7oQGq8
    U"%UOX[wMMC[tToEsRO\^AY)?_)kg,[&sIHz/p=wt%F^dJ(zpYT+J.-IQ?DdnqbqY
    U"[OD%_.+)+MJH85=7CqTg1%Vi6Tm<qMK#ylFx0-)y<=FCD*DA7k1j>=auqQaEu:a
    U"TuY5o.hepLRUFfD*A1='QVe&F&%u%p()9%%%%-d%66^aIH$b'w:;%4%QL%%%1%%
    U"%%qsl%ksfr%WSgfOxf,JY&TAafx$k<YFanaE*lV+A;(n/<A,ZlWi\*LgQb_RcV< U"6/G;dieE1aAUX$,XLbzsF.D)<U/j-B\HIq%FFtx33c>&NN4T^nTjdYb:/hD0T]J
    U"zBS]rh$Cs> )wNojdd:dn:#.gXn(N=a5w^f9-+qXt.0<A-j%-Drf^BI)n,_Sfv8j
    U"^5:m>$[EHL)qV$lN=3BQ4>oWAKX8T,Rc1gk&eFosHYjfcjUbK=JP%F5\l)n4YF4
    U"fUSlXwK,U2dwQ9C:w8+?vD5Gz0s381k4ra]8hPm/QoQ8_)odZ$9RWGav8:Kvj[M
    U"-Xq1d+$Vs(%nZc[1_RSyQ0R3st17e(f/<$ZKMCM#05.48SiZT,:h9O]C^<#RF+B
    U"\J)35jx_A828e'8j]]x9jicAW>uQTdF:P\s8n=c6T#f-s)8j0Bj61kr]t$h-kG6
    U"ErfIedd(Rk.=Sc;q80hrWFFLUHhj-h/VEiHN_J0C)k56[qQ7E(bo/b[/'Ea:4Vl
    U"Edq-h&KpBKG1qw>lcl9HO&7)9hO=SZ:ZkJajY\p=]_U*)M(WCKC>WPjG_J1H*L#

    What am I supposed to do with that!

    Besides I dont want a library I just want a single line:

    GETFULLPATHNAME(??, ??, ??, ??)

    I am trying to recover the full path name from a command line string so I can open a file with the full name not the 8.3 name.

    snip ...

    FUNCTION CheckData() AS LONG
    IF COMMAND$ = "" THEN
    IF GetFileName = 0 THEN EXIT FUNCTION ' open dialog and check for CANCEL
    ELSE
    j = INSTR(-1, COMMAND$, "\")
    FilePathStr = LEFT$(COMMAND$, j) ' ShortName
    FileNameStr = RIGHT$(COMMAND$, LEN(COMMAND$)-j) ' ShortName
    j = GETFULLPATHNAME(?????????????)
    FilePathStr = ???? ' Full Name
    FileNameStr = ???? ' Full Name
    END IF
    CHDIR FilePathStr
    DestFile = PARSE$(FileNameStr, any ".", 1)+"Log.txt"

    OPEN FilePathStr+FileNameStr FOR INPUT AS 100 LEN = 32768 ' Open data file
    LINE INPUT #100, InputStr ' check first line of data for format

    OPEN FilePathStr+DestFile FOR OUTPUT AS 300 LEN = 32768 ' open output file Error Log
    PRINT# 300, "Results For: "+FileNameStr ' full name as it appears in a folder


    Does anyone know of an example of the sfn to lfn conversion somewhere?


    ------------------
    Kind Regards
    Mike

  • #2
    that is a dos library in packed format... you simply load that file into pb/dos and run it - it in turn creates a zip file which you oppen with winzip, etc.

    however, that dos code won't help you much with pb/dll or pb/cc since our windows compilers natively support lfn's directly (it is just the compiler that does not support lfn's). ie, open "c:\program files\my data directory\my long filename.dat" for input as #1

    that said, there are much easier ways to obtain a lfn to a file than going through the api. for example, if the file is in the current directory, you use simply curdir$ to get the current directory in lfn format.

    if the file is elsewhere, well, you probably know the file name because you need the path to reach the file, right? relative paths can be solved the same way, derived from the base directory returned by curdir$.

    is there any particular reaason you need to resolve the lfn? that is, you can also use a sfn to open a file too - just use the sfn path directly, ie, open "c:\progra~1\data\file.dat" for input as #1

    if so, take a look at http://161.58.186.98/files/tip511.html - it reportedly works fine (according to the thread at http://www.powerbasic.com/support/pb...ead.php?t=3333 )

    finally, take a look to http://www.powerbasic.com/support/pb...ead.php?t=2956 - essentially, it contains a powerbasic version of the vb code.

    i hope this helps!

    ------------------
    lance
    powerbasic support
    mailto:[email protected][email protected]</a>
    Lance
    mailto:[email protected]

    Comment


    • #3
      ----------------------------------------
      Is there any particular reaason you need to resolve the LFN?
      ------------------------------------------
      I have a file called:
      CompositTreatedSP1min.dta

      I want to open it, process it and produce:
      CompositTreatedSP1min.log

      Then I want to do the same for:
      CompositRawSP1min.dta
      CompositUnTreatedSP1min.dta
      CompositSyntheticSP1min.dta
      ...

      So Comp~1.log doesnt quite cut it! I need to be able to convert the sfn to the lfn. As far as the path, you are quite correct, that can remain in sfn.

      I will play with the examples...

      thx alot Lance.


      ------------------
      Kind Regards
      Mike

      Comment

      Working...
      X