delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/01/10:10:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <08B08C9FA5EBD311A2CC009027D5BF81032B0FA5@remailnt2-re01.westat.com>
From: Francis Harvey <HARVEYF1 AT WESTAT DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: RE: GCC and getcwd
Date: Fri, 1 Feb 2002 10:11:42 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Greetings,

I was pretty sure it was a conceptual problem, so thanks to
everybody for confirmation.  Now, I simply have my wrapper
WinBatch program pass the path to its executable which is
guaranteed to be in the same folder as the text file I am
looking for.

Curiously, up till this point, I had assumed that because
I was passing paths in my programs parameters that they were
being corrected so escape character sequences wouldn't occur
in the string.  However, now I load all of the paths my
program needs from a single text file without any corrections
and my files still open even though I thought the single
slashes would indicate escape sequences.  It works anyway.
Weird.

Thanks again.

Francis R. Harvey III
WB303, x3952
harveyf1 AT westat DOT com

VB programmers know the wisdom of Nothing

> -----Original Message-----
> From: Francis Harvey 
> Sent: Thursday, January 31, 2002 1:21 PM
> To: 'cygwin AT cygwin DOT com'
> Subject: GCC and getcwd
> 
> 
> Greetings,
> 
> This isn't directly a cygwin question, but hopefully somebody has a
> suggestion or a new topic I should search on:
> 
> I have a working C program created with GCC 2.95.2-6 and Cygwin
> dll 1.1.7.  I realize both of these are a little old, but I think
> I have a conceptual problem rather than a version issue.
> 
> I want to find the current directory that the executable file is in,
> so I can open a text file in the same directory.  The executable
> is on the k drive, but my code doesn't return the correct path:
> 
> /* Begin code sample */
> main()
> {
> 	  FILE *testfile;
>         char buffer[100];
>         int size = 100;
> 
>         testfile = fopen("c:\\windows\\desktop\\test.txt","w");
>         getcwd(buffer,size);
>         fprintf(testfile,"buffer = %s\n",buffer);
> }
> /* End code sample */
> 
> which returns:
> buffer = /cygdrive/c/WINDOWS/DESKTOP
> 
> I am probably using the wrong function or possibly need to look
> at a Windows-based group of functions?
> 
> TIA for any ideas.
> 
> Francis R. Harvey III
> WB303, x3952
> harveyf1 AT westat DOT com
> 
> VB programmers know the wisdom of Nothing
> 
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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