Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use quotes in a string? 1

Status
Not open for further replies.

computerwhiz

Programmer
Joined
May 1, 2002
Messages
28
Location
US
I am wanting to be able to use a double quote within my string constant, but whenever I type them in the string is split and I get parsing errors. I am writing a program that parses a specific file format into a .CSV file, so I need to use " and not ' to identify the separate values.

Code:
#include <windows.h>

#include &quot;Main.h&quot;

static char g_szClassName[] = &quot;MyWindowClass&quot;;
static HINSTANCE g_hInst = NULL;
static BOOL ReadyToParse = FALSE;
static LPSTR pszText;
Code:
static LPSTR Quote_A=&quot;'&quot;; I want to use &quot;&quot;&quot;
static LPSTR Quote_B=&quot;','&quot;; I want to use &quot;&quot;,&quot;&quot;
Code:
static LPSTR Return=&quot;\r\n&quot;;
static LPSTR Header=&quot;'Number','Date','Remark','Gross','Deductions','Amount Paid'&quot;;
static int txtpos=0, count=0, adj=0;
static BOOL Neg=FALSE;

#define IDC_MAIN_TEXT   1001
 
if you want to use &quot; then use \&quot;
if you want to use \ then use \
learn more about escape characters

static LPSTR Quote_A=&quot;\&quot;&quot;; //I want to use &quot;&quot;&quot;
static LPSTR Quote_B=&quot;\&quot;,\&quot;&quot;;// I want to use &quot;&quot;,&quot;&quot;

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top