473,406 Members | 2,345 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,406 software developers and data experts.

Unterminated string literal

Hi All,

I am using "C" to generate the javascript code. And i am getting the
following error message "Unterminated string literal" in the mozilla
webbrowser for the following syntax.

unsigned char *Buf="Test"

printf("alert(\"%s\");\n\n",Buf);

I see an error message alert("Test Unterminated string literal in the
Javascript console of Mozilla web browser.

Nov 14 '05 #1
1 4646
In article <11**********************@l41g2000cwc.googlegroups .com>,
<va*****@agilis.st.com.sg> wrote:
I am using "C" to generate the javascript code. And i am getting the
following error message "Unterminated string literal" in the mozilla
webbrowser for the following syntax. unsigned char *Buf="Test" printf("alert(\"%s\");\n\n",Buf); I see an error message alert("Test Unterminated string literal in the
Javascript console of Mozilla web browser.


I take it this is intended to be the C code that runs within the
context of a CGI script that will send output to a browser?

You are missing the semicolon after the declaration line.

One variation you could experiment with is to use

printf("alert('%s');\n\n",Buf);

Either way, in the general case unless you know that
the contents of Buf is safe, you should pass it through a routine
to escape any quote-marks it has internally.
--
Ceci, ce n'est pas une idée.
Nov 14 '05 #2

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

Similar topics

5
by: KathyB | last post by:
Hi, this is the first lines of a function. Although it runs, it still throws an "Unterminated string constant" error in the browser. It is all in one line, just wouldn't fit here. The error...
2
by: Daniel Secomb | last post by:
Hi, I'm using PostgreSQL 7.3.4 on phpPgAdmin 2.4.2 and I'm getting the following error when I try and run a SQL query on a script: Error -...
3
by: aroraamit81 | last post by:
Hi, I am facing a problem in javascript. strdata is a variable of javascript and following is an assignment( hmmmmmmmmmmm a Huge one but unfortunately its not mine code, I am just trying to...
2
by: polilop | last post by:
When i open my page in IE it shows an error Unterminated string constant om Line..... When i look at the line it shows the line where the </SCRIPT> tag is ???? Moziila dose not see this error,...
1
by: larrylyons | last post by:
I don't understand why I'm getting Unterminated String Literal error MY JAVASCRIPT function test(){ newWindow =...
7
by: vunet.us | last post by:
I have a function to open new window: function bla(){ newwin = window.open("page.asp?file=1&id=<%=ID %>","Image","other params") } This function works fine mostly, but sometimes, there is a...
7
basstradamus
by: basstradamus | last post by:
Hi When I am trying to eveluate object literal It causing Unterminated string constans error (firefox). var obiekt = (eval("("+data+")")); the data is carring object literal recived from server...
0
by: manojpolawar2008 | last post by:
Hi, I am using the fckeditor with asp.net2.0. I have declared and initialized and the FCKEditor on code behind(ie on aspx.vb) page. and i wan to set the ViewState value to FckEditor on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.