rol@grasp1.univ-lyon1.fr (Paul Rolland) (04/16/91)
Hi networkers,
I've experimented the following : when I used the IBM C/2 functions
fopen or open to open a file that is situated on an HPFS disk, I always
have a return code telling me that the file hasn't been found. If I just
change in my program the disk to access a DOS disk, it works...
So, is access to an HPFS disk impossible with fopen and open, and
will I be oblige to use the OS/2 DosOpen ? If not, what is the problem ?
Second problem, that is related : I did the following
#include <stdio.h>
#include <io.h>
void main(void)
{
FILE * fd;
fd=fopen("E:\\FILENAME","r");
printf("Fopen done\n");
fclose(fd);
printf("fclose done\n");
}
But I never see the second message, I have a trap with a protection
violation before... Is it normal, with E being an HPFS disk ?
Paul.
Paul Rolland, engineer [I hope :)] in July 91,
Specialist of assembly on PC [Not too bad in fact :)],
Trying to progress on Unix administration
Email : rol@grasp1.univ-lyon1.fr
ballard@cheddar.ucs.ubc.ca (Alan Ballard) (04/17/91)
In article <1991Apr16.162439.24649@grasp1.univ-lyon1.fr> rol@grasp1.univ-lyon1.fr (Paul Rolland) writes: > I've experimented the following : when I used the IBM C/2 functions >fopen or open to open a file that is situated on an HPFS disk, I always >have a return code telling me that the file hasn't been found. If I just >change in my program the disk to access a DOS disk, it works... If the file you are trying to access has a name that wouldn't be a valid FAT name (i.e., not 8.3), fopen won't find it *unless* you mark the program as "long name aware". This is done via either an attribute in the .def file for the linker, or by running exehdr or markexe on the linked program. If this isn't the problem, I don't have any other ideas -- I've used fopen on hpfs files without any trouble. Alan Ballard | Internet: ballard@ucs.ubc.ca University Computing Services | Bitnet: USERAB1@UBCMTSG University of British Columbia | Phone: 604-822-3074 Vancouver B.C. Canada V6R 1Z2 | Fax: 604-822-5116
dans@microsoft.UUCP (Dan SPALDING) (04/24/91)
In article <1991Apr16.162439.24649@grasp1.univ-lyon1.fr> rol@grasp1.univ-lyon1.fr (Paul Rolland) writes: > > fd=fopen("E:\\FILENAME","r"); didn't anyone tell you to check pointers for validity before using them? the FILE* is null from fopen if the open failed. check you errno for more info. maybe the file doesn't exist? anyway, it shouldn't be a problem to open a file on an hpfs drive. it acts pretty much as a FAT drive would with 8.3 files. you might make sure your .exe is marked with the "long filename" support if the file you are trying to open is not 8.3. the linker/def file can be used to do this. just add "NEWFILES" to the line with the program name in the .def file. ------------------------------------------------------------------------ dan spalding -- microsoft systems/languages -- microsoft!dans "there has not been a word invented that would convey my indifference to that remark." - paraphrase from hawkeye pierce -- ------------------------------------------------------------------------ dan spalding -- microsoft systems/languages -- microsoft!dans "there has not been a word invented that would convey my indifference to that remark." - paraphrase from hawkeye pierce