www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/01/17/12:57:45

From: sngattan AT interceptor DOT ksu DOT ksu DOT edu (Down and Under)
Subject: C-language Problem?
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Sun, 17 Jan 93 11:12:12 CST

Hello:

	Maybe this is not the right group to post this query...but
since this is a C-language problem and I am using Gnuc, I thought
that someone on this net will be kind enough to help me.

	I am working on an IBM-PC and an trying to open a file using
the "fopen" command.  As long as I open the file in the same directory
where I am running my executable, it works fine.  But the moment I 
specify a path..it cannot find that file.  Here is the complete 
description of the problem"

	I am working in c:\ktran\image directory.  I want to open
a file in c:\ktran\pgm directory...the filename is "crk1.pgm"

****Begin part of the code

	
	char buffer[80];
	buffer = "c:\\ktran\\pgm\\crk1.pgm";

	inpfile = fopen (buffer,"rb");
        if (inpfile == NULL) {
		fprintf (stderr,"Cannot open input file ******"\n");
		return 0;
	}

****End of code

	Notice that I have to use two backslashes since a backslash
represnts an escape sequence otherwise.

	I hope I have described my problem and someone will be able
to help me out.  Thanks and bye

				sanjay
				sngattan AT matt DOT ksu DOT ksu DOT edu



- Raw text -


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