Subject: embedding new lines in text strings?

From: Rod Rebello -- CAD Development <rrebello@titan>
Date: Mon, 21 Oct 1991 17:35:54 -0700

I want to store text strings in the the database which may contain new line
characters.  Postgres (actually the scanner) complains that there is an
"Unterminated char/string constant".  I can't easily escape the new line
chars (if this would work) because the text is coming from a user typing into
a tty.  I just grab the buffer and try to save it.  To escape the new lines,
I would actually have to scan the buffer and modify it (yech).  

Is there an easy way around this problem?  Can the scanner safely be modified 
to ignore new lines just in strings of type text?  

Or am I all wet and just don't know what I'm doing?

-- 
Rod Rebello
[email-masked]
Microchip Technology Inc., Chandler, AZ

---

From: [email-masked] (Greg Kemnitz)
Date: Mon, 21 Oct 91 22:03:24 -0700

The scanner has no knowledge of type - it takes a string which is ultimately
passed to your input function.  You can pass a newline by using "\n" as in
printf, or by using a backslash to hide the newline character.

The following two strings 

"this is a text \
string"

and

"this is a text \nstring"

will be parsed as

"this is a text <newline>string"

	Greg Kemnitz
	[email-masked]