www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/30/06:00:09

Date: Fri, 30 Jul 93 11:23:10 +0200
From: kuku AT acds DOT physik DOT rwth-aachen DOT de (Christoph Kukulies)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Novell problem

The code example below (which should return 0 0 from both fstat calls
when the file is there and located on a network drive) fails not only
under djgpp but - and that's the reason why djgpp fails - under Turbo C.

Someone compiled it under MSC 5.1 and told me it works OK. So the 
question now is: can go32 be compiled using MSC :-) ?

Again the example:
#include <fcntl.h>
#include <sys/stat.h>
main(argc,argv)
int argc;
char **argv;
{
	int i,j;
	struct stat buf;
	if(argc!=2)
		printf(" pass filename\n"),exit(1);
        j=open(argv[1],O_RDONLY,0666);
	printf("fstat returns: %d\n",fstat(j,&buf));
	i=creat(argv[1],0666);
	close(i);
	printf("fstat returns: i=%d %d\n",i,fstat(j,&buf));
}

The difference between the file opened on the network drive and a local file
is that it does not have the -A----- bit (Archive) set. Maybe there is
a workaround putting the archive bit into the file mode but I don't know
if it's possible to explicitly set this bit via an open().


--Chris


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019