TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Mick Mcham
from: Bob Stout
date: 1998-07-24 20:35:40
subject: fopen - specify directory

On , Mick Mcham (1:106/4100{at}fidonet) wrote: 

 > The following works just fine but creates the file in the default 
 > directory:     fopen("testfile", "w");

 > However, if I try to include the path in the file name such as 
 > fopen("c:\testfile", w); it does not work.

 > How do you specify the path for file creation?

Mick...

  In C, '\' is the escape character, so you have to double it, i.e. 

      fopen("c:\\testfile", "w"); 

  BTW, an easy alternative is to use '/' as the path delimiter. Only some
DOS and Windows programs *require* that you use the '\' character (the most
significant one being COMMAND.COM). Try it, you'll find this works just as
well...

      fopen("c:/testfile", "w"); 


--- QM v1.00
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 30883/6 106/2000 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.