1. Long filenames

I'm writing a program under Dos32 which generates long filenames. I've
heard that Euphoria can deal with long filenames but mine won't work.
I think it's because the first 8 digits of some of them are the same,
(and need to stay the same) eg "m3572856" "m35728564" "m357285641" etc.
As far as I know I'm going to have to write a filename "nanny" which will allow
me to attach one filename to it's parent (specific to this program).
I think I've got that thought out but it's going to be complicated.
At the moment, when the file name grows past the 8 digits, E just refuses
to open the file. No error messages, no crash, which makes me wonder if
there might be an easier way lurking near.
Any ideas?
Andrew (Razor) Sharp

new topic     » topic index » view message » categorize

2. Re: Long filenames

At 05:34 p.m. 06-01-99 , you wrote:
>I'm writing a program under Dos32 which generates long filenames. I've
>heard that Euphoria can deal with long filenames but mine won't work.

Long filenames are supported on DOS 7.0+ (Win95).


Regards,
        Daniel   Berstein
        daber at pair.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Long filenames

I don't think the current DOS version of EUPHORIA can *write* long
filenames. If one already exists, it can be opened.

What I do is create the file, then use a system call to rename it to the
long filename I want.

Andrew Sharp wrote:
>
> I'm writing a program under Dos32 which generates long filenames. I've
> heard that Euphoria can deal with long filenames but mine won't work.
> I think it's because the first 8 digits of some of them are the same,
> (and need to stay the same) eg "m3572856" "m35728564" "m357285641" etc.
> As far as I know I'm going to have to write a filename "nanny" which will
> allow me to attach one filename to it's parent (specific to this program).
> I think I've got that thought out but it's going to be complicated.
> At the moment, when the file name grows past the 8 digits, E just refuses
> to open the file. No error messages, no crash, which makes me wonder if
> there might be an easier way lurking near.
> Any ideas?
> Andrew (Razor) Sharp

new topic     » goto parent     » topic index » view message » categorize

4. Re: Long filenames

On Wed, 6 Jan 1999, Andrew Sharp wrote:

> I'm writing a program under Dos32 which generates long filenames. I've
> heard that Euphoria can deal with long filenames but mine won't work.
> I think it's because the first 8 digits of some of them are the same,
> (and need to stay the same) eg "m3572856" "m35728564" "m357285641" etc.
> As far as I know I'm going to have to write a filename "nanny" which will
> allow me to attach one filename to it's parent (specific to this program).
> I think I've got that thought out but it's going to be complicated.
> At the moment, when the file name grows past the 8 digits, E just refuses
> to open the file. No error messages, no crash, which makes me wonder if
> there might be an easier way lurking near.
> Any ideas?

Yup. For the file-splitter I wrote, I wanted to deal with Long Filenames.
Here's part of the split.e library I wrote for it:

-- win95fh.e --
 ---------------------------------------------------------------------------
-- [Windows 95] File Handling                                              --
 ---------------------------------------------------------------------------
global function exist(sequence filename)
    integer status

    --system("cd " & current_dir(), 2)
    -- open() works on Win95 filenames!
    status = open(filename, "rb")
    if status != -1 then
        close(status)
        return 1
    end if

    return 0
end function

global function is_long_filename(sequence filename)
    -- Not perfect but does a fairly good job...
    integer dotpos

    dotpos = find('.',filename)
    if dotpos then
        filename[dotpos] = -'.'
    end if

    if find('.',filename) or find(' ', filename) or
    (dotpos = 0 and length(filename) > 8) or
    (dotpos > 0 and length(filename)-dotpos > 3)then
        return 1
    else
        return 0
    end if

end function

global function open95(sequence filename, sequence mode)
    integer handle
    if not length(mode) or not length(filename) then
        return -1
    end if

    if mode[1] != 'r' then
        if not exist(filename) then
            if is_long_filename(filename) then
                system("rem > \"" & filename & "\"", 2)
            else
                system("rem > " & filename, 2)
            end if
        end if
    end if

    handle = open(filename, mode)
    return handle
end function

-- end win95fh.e --

Happy coding,
Carl

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

new topic     » goto parent     » topic index » view message » categorize

5. Re: Long filenames

Carl R. White wrote:
>
> On Wed, 6 Jan 1999, Andrew Sharp wrote:
>
> > I'm writing a program under Dos32 which generates long filenames. I've
> > heard that Euphoria can deal with long filenames but mine won't work.
> > I think it's because the first 8 digits of some of them are the same,
> > (and need to stay the same) eg "m3572856" "m35728564" "m357285641" etc.
> > As far as I know I'm going to have to write a filename "nanny" which will
> > allow me to attach one filename to it's parent (specific to this program).
> > I think I've got that thought out but it's going to be complicated.
> > At the moment, when the file name grows past the 8 digits, E just refuses
> > to open the file. No error messages, no crash, which makes me wonder if
> > there might be an easier way lurking near.
> > Any ideas?
>
> Yup. For the file-splitter I wrote, I wanted to deal with Long Filenames.
> Here's part of the split.e library I wrote for it:
>
> -- win95fh.e --
>  ---------------------------------------------------------------------------
> -- [Windows 95] File Handling                                              --
>  ---------------------------------------------------------------------------
> global function exist(sequence filename)
>     integer status
>
>     --system("cd " & current_dir(), 2)
>     -- open() works on Win95 filenames!
>     status = open(filename, "rb")
>     if status != -1 then
>         close(status)
>         return 1
>     end if
>
>     return 0
> end function
>
> global function is_long_filename(sequence filename)
>     -- Not perfect but does a fairly good job...
>     integer dotpos
>
>     dotpos = find('.',filename)
>     if dotpos then
>         filename[dotpos] = -'.'
>     end if
>
>     if find('.',filename) or find(' ', filename) or
>     (dotpos = 0 and length(filename) > 8) or
>     (dotpos > 0 and length(filename)-dotpos > 3)then
>         return 1
>     else
>         return 0
>     end if
>
> end function
>
> global function open95(sequence filename, sequence mode)
>     integer handle
>     if not length(mode) or not length(filename) then
>         return -1
>     end if
>
>     if mode[1] != 'r' then
>         if not exist(filename) then
>             if is_long_filename(filename) then
>                 system("rem > \"" & filename & "\"", 2)
>             else
>                 system("rem > " & filename, 2)
>             end if
>         end if
>     end if
>
>     handle = open(filename, mode)
>     return handle
> end function
>
> -- end win95fh.e --
>
> Happy coding,
> Carl
>
> --
> Carl R White -- Final Year Computer Science at the University of Bradford
> E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
> URL......: http://www.bigfoot.com/~cyrek/
> Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

Excuse me, but are you shure using EXW.EXE and not EX.EXE or
BINDW and not BIND?

Have a nice day (or night), Rolf

new topic     » goto parent     » topic index » view message » categorize

6. Re: Long filenames

Message "tidied". Not in standard "> > >" form...

  On Wed, 6 Jan 1999, Andrew Sharp wrote:
  >
  > [Help me with LFNs]

I replied:
>
> Here's part of the split.e library I wrote for LFNs:
> [snippy]

  On Mon, 11 Jan 1999, Rolf Schroeder wrote:
  >
  > Excuse me, but are you shure using EXW.EXE and not EX.EXE or
  > BINDW and not BIND?

Sorry. The code was intended for all versions of EX, not for EXW which I
imagine works fine without needing my improvements...

Carl

PS I know my messages are LOOONG Rolf, but did you have to quote it all?
   /me does Net[cit]izen Salute "colon-closebracket"

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu