473,499 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax for literal "s on Windows command line

Not exactly a C question (sorry), but I couldn't
find a ng that seems more suitable...

On the Unix shell command line I can successfully write
cc -DPATH=\"abcd/\" program.c -o program
to compile program as if it contained the line
#define PATH "abcd/"

But using the free MinGW http://www.mingw.org Windows
C compiler, then
gcc -DPATH=\"abcd\\\" program.c -o program
fails when written from a DOS Command Prompt window.
It kind of looks like the open quote hasn't closed
and the command line interpreter is waiting for the
command to be completed. I tried various and sundry
permutations like "\"abcd\\\"" and ""abcd\\"" and
\\\"abcd\\\\\", etc, but nothing I tried seems to work.
(The program compiles and runs fine without that switch,
using the default PATH.) What's the correct way to
write this? Thanks.
--
John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
Feb 1 '06 #1
7 2563

"John F" <jo**@PleaseSeeSigForAddress.com> wrote in message
news:dr**********@reader2.panix.com...
Not exactly a C question (sorry), but I couldn't
find a ng that seems more suitable...
Then imo you didn't look very hard. :-)

On the Unix shell command line I can successfully write
cc -DPATH=\"abcd/\" program.c -o program
to compile program as if it contained the line
#define PATH "abcd/"

But using the free MinGW http://www.mingw.org Windows
C compiler, then
gcc -DPATH=\"abcd\\\" program.c -o program
fails when written from a DOS Command Prompt window.
It kind of looks like the open quote hasn't closed
and the command line interpreter is waiting for the
command to be completed. I tried various and sundry
permutations like "\"abcd\\\"" and ""abcd\\"" and
\\\"abcd\\\\\", etc, but nothing I tried seems to work.
(The program compiles and runs fine without that switch,
using the default PATH.) What's the correct way to
write this? Thanks.


<OT>
Unix and Windows interpret the '/' and '\' characters differently.
E.g. in Windows command line, '\' is treated as part of
a 'path', and a double-quote character is not a valid character
in a folder or file name. In order to learn how to use the gcc
implementation for Windows, you'll need to study its documentation.
</OT>

For additional assistance, I suggest you do some or all of the
following: visit a gcc newsgroup, gcc web site, or subscribe
to a gcc mailing list. Google should be able to find them
easily.

-Mike
Feb 1 '06 #2
use the gcc -I or -L option to include that particular lib in path

Feb 1 '06 #3
Mike Wahler wrote:
"John F" <jo**@PleaseSeeSigForAddress.com> wrote in message
news:dr**********@reader2.panix.com...
Not exactly a C question (sorry), but I couldn't
find a ng that seems more suitable...


Then imo you didn't look very hard. :-)
On the Unix shell command line I can successfully write
cc -DPATH=\"abcd/\" program.c -o program
to compile program as if it contained the line
#define PATH "abcd/"

But using the free MinGW http://www.mingw.org Windows
C compiler, then
gcc -DPATH=\"abcd\\\" program.c -o program
fails when written from a DOS Command Prompt window.
It kind of looks like the open quote hasn't closed
and the command line interpreter is waiting for the
command to be completed. I tried various and sundry
permutations like "\"abcd\\\"" and ""abcd\\"" and
\\\"abcd\\\\\", etc, but nothing I tried seems to work.
(The program compiles and runs fine without that switch,
using the default PATH.) What's the correct way to
write this? Thanks.


<OT>
Unix and Windows interpret the '/' and '\' characters differently.
E.g. in Windows command line, '\' is treated as part of
a 'path', and a double-quote character is not a valid character
in a folder or file name. In order to learn how to use the gcc
implementation for Windows, you'll need to study its documentation.
</OT>

For additional assistance, I suggest you do some or all of the
following: visit a gcc newsgroup, gcc web site, or subscribe
to a gcc mailing list. Google should be able to find them
easily.


One (OT) remark:
"abcd/"
also works with Windows and is the canonic form
you _should_ use.
Coding standards like MISRA even demand that.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Feb 1 '06 #4
Shastri wrote:
use the gcc -I or -L option to include that particular lib in path


Please provide sufficient context.
This is off-topic advice which may or may not be good.
Please refer the OP to a better NG, e.g. gnu.gcc.help
or give your advice and crosspost with f'up set appropriately.

There are scenarios where the OP's version may be needed, for
example to disambiguate between headers of equal name.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Feb 1 '06 #5
John F <jo**@PleaseSeeSigForAddress.com> writes:
Not exactly a C question (sorry), but I couldn't
find a ng that seems more suitable...

On the Unix shell command line I can successfully write
cc -DPATH=\"abcd/\" program.c -o program
to compile program as if it contained the line
#define PATH "abcd/"

But using the free MinGW http://www.mingw.org Windows
C compiler, then
gcc -DPATH=\"abcd\\\" program.c -o program
fails when written from a DOS Command Prompt window.

[...]

You couldn't find a newsgroup that discusses MS-DOS or Windows? I see
16 newsgroups with "msdos" in their names, and 76 with "ms-windows" in
their names.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 1 '06 #6
Michael Mair <Mi**********@invalid.invalid> wrote:
: Shastri wrote:
: > use the gcc -I or -L option to include that particular lib in path

: Please provide sufficient context.
: There are scenarios where the OP's version may be needed, for
: example to disambiguate between headers of equal name.
Yes, my problem doesn't involve library or include paths.
I'm trying to -D define a string that specifies a path
where the program will cache its results when it runs.
See http://www.forkosh.dreamhost.com/php...topic.php?t=48
for the actual problem, asked by a user of my gpl'ed program
(skip the top two posts which deal with a different problem)

: This is off-topic advice which may or may not be good.
: Please refer the OP to a better NG, e.g. gnu.gcc.help
Thanks, I'll re-post to this group.

: Michael E-Mail: Mine is an /at/ gmx /dot/ de address.
--
John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
Feb 1 '06 #7
Keith Thompson wrote:
John F <jo**@PleaseSeeSigForAddress.com> writes:
Not exactly a C question (sorry), but I couldn't
find a ng that seems more suitable...
.... snip ...
You couldn't find a newsgroup that discusses MS-DOS or Windows?
I see 16 newsgroups with "msdos" in their names, and 76 with
"ms-windows" in their names.


I find 59 and 173 respectively on my server! :-)

--
"The power of the Executive to cast a man into prison without
formulating any charge known to the law, and particularly to
deny him the judgement of his peers, is in the highest degree
odious and is the foundation of all totalitarian government
whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
Feb 2 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5033
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
0
2412
by: Tom Dacon | last post by:
"Open .Net Command Window Here" context menu for Windows Explorer: The reg file described below adds a new menu item to Windows Explorer's context menu when you right-click over a folder (or the...
9
7108
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
1
11226
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
8
20258
by: aine_canby | last post by:
>>v = raw_input("Enter: ") Enter: kjjkj Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: 'kjjkj' In my program I need...
4
2446
by: chaitu | last post by:
Hi guys, I've written a parallel build program (in Perl) that takes a pre-computed dependency tree of many projects in 2 visual studio .net 2003 solution (.sln) files here at my company, and...
3
12158
priyan
by: priyan | last post by:
hai everybody, I need to copy data from a text file to a table i used copy command like this copy city from 'e\ccccc.txt' with delimiter as ',' it worked successfully. But now i...
25
30772
by: Peng Yu | last post by:
Hi, It is possible to change the length of "\t" to a number other than 8. std::cout << "\t"; Thanks, Peng
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.