[comp.os.os2.misc] Using fopen with HPFS

NEATH@cgi.com (07/26/90)

I have an IBM PS/2 model 70/486 running OS/2 1.2 EE. I recently upgraded
from a FAT-based file system to HPFS. Since doing so, I am unable to get
fopen() to work if the character string argument specifies a filename
that is not of the 8.3 variety, ie. a *new* longer but valid HPFS filename.
I am using MSC 6.0 and associated utilities. Is there a new/different C
runtime library needed for file I/O under HPFS?

Thanks,
Martin Neath <neath@itg.ti.com>

dyoung@cup.portal.com (David Michael Young) (07/26/90)

THe MSC runtime library uses the OS/2 DosOpen function to open up files, which
(unfortunatly) restricts you to the 8.3 convention.  With OS/2 1.2, there is a
new call, DosOpen2, that allows unrestricted file names. 
 
Your best bet is to write a replacement for fopen that uses the right OS call.



==============================================================================
"It's a Dog-eat-dog world out there... And I'm wearing Milk Bone underwear."
					   - Norm Peterson

David Young	dyoung@cup.portal.com

eric@mks.mks.com (Eric Gisin) (07/27/90)

.From: dyoung@cup.portal.com (David Michael Young)
.
.THe MSC runtime library uses the OS/2 DosOpen function to open up files, which
.unfortunatly) restricts you to the 8.3 convention.  With OS/2 1.2, there is a
.new call, DosOpen2, that allows unrestricted file names. 

No, DosOpen has absolutely no 8.3 restriction.
Most likely they forgot to use "exehdr /newfiles" or equivalent
to mark the EXE file as HPFS-capable.

dyoung@cup.portal.com (David Michael Young) (07/28/90)

My mistake... Sorry for the incorect information. DosOpen2 is required for
extended attributes, not for HPFS file names.


=============
David Young
dyoung@cup.portal.com

mikemo@microsoft.UUCP (Mike Morearty) (07/29/90)

In article <1990Jul25.210712.14454@csc.ti.com> NEATH@cgi.com writes:
>                                                      I am unable to get
>fopen() to work if the character string argument specifies a filename
>that is not of the 8.3 variety, ie. a *new* longer but valid HPFS filename.
>I am using MSC 6.0 and associated utilities. Is there a new/different C
>runtime library needed for file I/O under HPFS?

Programs that can use the abilities of HPFS filesystems (mixed
case, long names, extended attributes, etc.) must be explicitly
marked as such.  If the executable does not have the NEWFILES
bit of the exe header set, OS/2 will not allow the program to
access files that have filenames other than 8.3.  (The reason
for this is backwards compatibility, so that old programs don't
become confused when run on an HPFS drive.)

Since you want your program to support HPFS filenames, you must
put the following line in the .DEF file used to compile the
program (if it doesn't have one, you must create one):

	NEWFILES

Or alternatively, after the link has finished, run the EXEHDR
program on your file to set the NEWFILES bit:

	exehdr /newfiles foo.exe

--
mikemo@microsoft

nacer@hpmcaa.mcm.hp.com (Abdenacer Moussaoui) (07/31/90)

What about an answer to the original posting, is fopen() restricted
to 8.3 files?  Some poeple still like to use the standard C library
thinking that it makes their code easier to port, will the OS/2 API's
ever be supported in unix?

Thank you.

alistair@microsoft.UUCP (Alistair BANKS) (08/02/90)

In article <15590006@hpmcaa.mcm.hp.com> nacer@hpmcaa.mcm.hp.com (Abdenacer Moussaoui) writes:
>What about an answer to the original posting, is fopen() restricted
>to 8.3 files?  Some poeple still like to use the standard C library
>thinking that it makes their code easier to port, will the OS/2 API's
>ever be supported in unix?

fopen is _not_restricted to 8.3 if you are using Microsoft C6 run-time
libraries, but remember that you must link with a .def file which
specifies that you can recognise long filenames.

As for OS/2 APIs on Unix - hey(!) its just software, someone could
do it some time! Don't hold your breath...

Alistair Banks
OS/2 Group
Microsoft

clarke@acheron.uucp (Ed Clarke/10240000) (08/02/90)

From article <15590006@hpmcaa.mcm.hp.com>, by nacer@hpmcaa.mcm.hp.com (Abdenacer Moussaoui):
> What about an answer to the original posting, is fopen() restricted
> to 8.3 files?  Some poeple still like to use the standard C library
> thinking that it makes their code easier to port, will the OS/2 API's
> ever be supported in unix?

I use fopen on an HPFS file system; it's not restricted to 8.3.   I have
no idea about the APIs.
-- 
               |
Ed Clarke      |  I prefer not to kill animals.  I'm a humanist; I'd
acheron!clarke |  rather kill a MAN than a snake.
               |                 - Edward Abbey (Desert Solitaire)

biron@eric.mpr.ca (Claude Biron) (08/08/90)

Could you comment on the speculation in PC Week (other than it's just
speculation) that OS/2 1.21 (the 2 meg 20% faster version) will not be
coming out shortly?

alistair@microsoft.UUCP (Alistair BANKS) (08/10/90)

In article <2289@kiwi.mpr.ca> biron@kiwi.UUCP (Claude Biron) writes:
>Could you comment on the speculation in PC Week (other than it's just
>speculation) that OS/2 1.21 (the 2 meg 20% faster version) will not be
>coming out shortly?

I can in part. MS OS/2 1.21 is coming out very shortly. The follow
on version of OS/2, which the press are referring to as the 2Mb OS/2
is not MS OS/2 1.21. As yet, a smaller OS/2 has only been part of
some technology demonstrations - no release dates have been announced.

We are still recommending 4Mb memory for a reasonable configuration of
MS OS/2 1.21, in which you can run network software and a few applications.

Alistair Banks
OS/2 Group
Microsoft