What is wrong with this call?

P

Peter Nilsson

Three problems at least. First, you put your question in
the subject line alone. Second, you're using so called
smart quotes in C code. Fix those and you're ready to
be directed to the FAQ (q19.17) for the third issue.
 
B

Ben Bacarisse

It helps if you put the question in the body of the post: "What is
wrong with this call?"
fopen(â€c:\try\clip1.datâ€, “râ€);

I was surprised to see that this is not a FAQ (unless I missed it).
To put \ into a C string literal you need to write \\. The sequence
\t is a tab character and \c is undefined. You can also side-step the
problem since almost every C library accepts / as an alternative in
file names.

Also, you have the wrong quotes. You need "..." not the characters
you have. These may simply have been inserted by your posting
software so it may not be an issue in your code.
 
A

Andrey Tarasevich

Firstly, the quotes look funny.

Secondly, '\' character in C string literals (and character constants)
is a escape character. Use '\\' to represent the backslash character.

fopen("c:\\try\\clip1.dat", "r");
 
M

Martin Ambuhl

fopen(â€c:\try\clip1.datâ€, “râ€);

\t is the escape sequence for a horizontal tab
\c is an undefined escape sequence

I doubt very much that your filename includes those characters.

There are two obvious suggestions to make:
1) If your question is worth asking, it is worth puting in the the body
of your message. Subject headers are not the place for anything
important for your message.
2) Buy any decent C text, and read the sections on character constants,
string literals, and escape sequences.
 

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,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top