fopen in specific environments

A

ataru

Sorry to ask a semi implementation-dependent question, but I'm having some
trouble with fopen() in a Windows environment... I want to open a file a la

FILE *f;
f=fopen( "L:\Apps\CTRemote\pairs", "r" );

I know the file exists, but I can't seem to get it open like this. If I use
lower case letters, it says the syntax is bad or something. Is there some
stupid trick to this?
 
M

Martin Ambuhl

Sorry to ask a semi implementation-dependent question, but I'm having some
trouble with fopen() in a Windows environment... I want to open a file a la

FILE *f;
f=fopen( "L:\Apps\CTRemote\pairs", "r" );

You have specified a name with the three single characters '\A', '\C', and
'\p'. There is no reason to use the dyslexic command.com naming style, but
if you must:
f=fopen( "L:\\Apps\\CTRemote\\pairs", "r" );
Better is to avoid escape sequences entirely:
f=fopen( "L:/Apps/CTRemote/pairs", "r" );
I know the file exists, but I can't seem to get it open like this.

Because you misnamed it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top