hello

I am trying to open a file which exists on my local PC using fopen

the file is located in
c:\B2B Data\files and is called file.txt

When i put the above into a variable called filename, i cannot open it

ie
char filename[27]="c:\B2B Data\files\file.txt";

i then issue an fp = fopen(filename, "r" );

Any ideas?

Use double back slashes instead.

>>char filename[27]="c:\B2B Data\files\file.txt";
your compiler should have issued a lot of error messages about that line. Never ever ignore errors or warnings (in your own code) Most of the time, like the above line, warnings are actually errors waiting to crash your program.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.