473,395 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

quoting quotes, &c.

if i wanted to call system with an argument to a function that had
double quotes and backslashes in it - for example

perl -e 'print "hello world\n"; '

how would i make that work? would it be:

std::system("perl -e 'print \"hello world\\n\"; ' ");

? are there other ways?

Jul 23 '05 #1
1 1226
jsnX wrote:
if i wanted to call system with an argument to a function that had
double quotes and backslashes in it - for example

perl -e 'print "hello world\n"; '

how would i make that work? would it be:

std::system("perl -e 'print \"hello world\\n\"; ' ");

?
Does it work for you? If it does, why ask "would it be"? If it does
not, what happens?

'system' function accepts a string that is passed in an implementation-
defined way to the host platform. Nothing beyond that is specified.
To add a backslash to a string literal, you need to double it. To add
a double quote, you need to escape it with a backslash.
are there other ways?


Yes, there are probably other ways, platform-specific, no doubt. In what
sense "other"? A different way to represent double quotes? Yes, you can
use the \xHH notation where HH is the value in the host character set,
representing the double quotation character, and you can use the same for
the backslash... Is that what you're asking for?

V
Jul 23 '05 #2

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

Similar topics

2
by: snacktime | last post by:
I'm used to using the perl DBI and not very familiar with the python DB-API. I am using PyGreSQL. My question is what is the standard way to quote strings in sql queries? I didn't see any...
16
by: mark | r | last post by:
anyone know a good formula for quoting for development work? i am a designer and have a partner who handles development work - my problem is that he continually under quotes on both time and...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
27
by: Ron Adam | last post by:
Hi, I found the following to be a useful way to access arguments after they are passed to a function that collects them with **kwds. class namespace(dict): def __getattr__(self, name): return...
12
by: yoni | last post by:
Hi, Consider the following XML document: <article> This is a sample <literal>document</literal>. Some <literal>words</literal>, from some reason, are tagged with the...
82
by: Edward Elliott | last post by:
This is just anecdotal, but I still find it interesting. Take it for what it's worth. I'm interested in hearing others' perspectives, just please don't turn this into a pissing contest. I'm in...
2
by: seven.reeds | last post by:
Hi, I am not a js expert by any stretch and this might be a perl question more than js but I have to start somewhere so fingers crossed... Ok, I am doing some ajax and have this '<input...
7
by: Steven W. Orr | last post by:
Python has a number of "quoting" 'options' to help """with times when""" one way may be more convenient than another. In the world of shell scripting, I use a technique that I call minimal...
6
by: Chuck Anderson | last post by:
Granted, this is mostly a mysql question, but I think understanding the Php makes it easy to understand why my question is necessary. I'm writing a Php loop to create INSERT and UPDATE queries...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.