Connecting Tech Pros Worldwide Forums | Help | Site Map

What is wrong with this call?

c.lang.myself@gmail.com
Guest
 
Posts: n/a
#1: Nov 18 '08
-----------------
fopen(”c:\try\clip1.dat”, “r”);
----------------

Peter Nilsson
Guest
 
Posts: n/a
#2: Nov 18 '08

re: What is wrong with this call?


"c.lang.mys...@gmail.com" <c.lang.mys...@gmail.comwrote:
Quote:
-----------------
fopen(”c:\try\clip1.dat”, “r”);
----------------
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.

--
Peter
Ben Bacarisse
Guest
 
Posts: n/a
#3: Nov 18 '08

re: What is wrong with this call?


"c.lang.myself@gmail.com" <c.lang.myself@gmail.comwrites:

It helps if you put the question in the body of the post: "What is
wrong with this call?"
Quote:
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.

--
Ben.
Ben Bacarisse
Guest
 
Posts: n/a
#4: Nov 18 '08

re: What is wrong with this call?


Peter Nilsson <airia@acay.com.auwrites:

<snip>
Quote:
>... Fix those and you're ready to
be directed to the FAQ (q19.17) for the third issue.
Drat. I did miss it!

--
Ben.
Andrey Tarasevich
Guest
 
Posts: n/a
#5: Nov 18 '08

re: What is wrong with this call?


c.lang.myself@gmail.com wrote:
Quote:
-----------------
fopen(”c:\try\clip1.dat”, “r”);
----------------
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");

--
Best regards,
Andrey Tarasevich
Martin Ambuhl
Guest
 
Posts: n/a
#6: Nov 18 '08

re: What is wrong with this call?


c.lang.myself@gmail.com wrote:
Quote:
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.
Sjouke Burry
Guest
 
Posts: n/a
#7: Nov 18 '08

re: What is wrong with this call?


c.lang.myself@gmail.com wrote:
Quote:
-----------------
fopen(”c:\try\clip1.dat”, “r”);
----------------
Rotten use of quote characters?
Closed Thread