Hi All,
Is there anything wrong with this syntax..I am generating javascript
code from "C" language.
unsigned char Buf="Test";
printf("alert(\ "%s\");\n\n",Bu f);
I am getting error "Unterminat ed string literal in the javascript
console
alert("Test
but i have terminated this string in my "c" code..?
Thanks 6 1725
Vanitha wrote: Is there anything wrong with this syntax..I am generating javascript code from "C" language.
unsigned char Buf="Test";
Are you sure you wouldn't need
unsigned char *Buf = "Test";
printf("alert(\ "%s\");\n\n",Bu f);
I am getting error "Unterminat ed string literal in the javascript console
alert("Test
but i have terminated this string in my "c" code..?
Hard to tell, if there really is
alert("Test
send to the browser then the script engine is right to flag the syntax
error.
You might want to ask in a C group perhaps as it is more a problem using
C to generate some string in a certain output format than being a
JavaScript problem.
If you have a public URL where the problem occurs then you could post it
here so that we can at least check whether other browsers have the same
problem. Which browser did you test with?
--
Martin Honnen http://JavaScript.FAQTs.com/ va*****@agilis. st.com.sg (Vanitha) writes: Is there anything wrong with this syntax..I am generating javascript code from "C" language.
It's not a Javascript problem, but a C problem.
unsigned char Buf="Test";
Should be
char *Buf = "Test";
As it is, you are assigning a pointer to a char variable. Only fun
can come from that :)
printf("alert(\ "%s\");\n\n",Bu f);
I am getting error "Unterminat ed string literal in the javascript console
alert("Test
but i have terminated this string in my "c" code..?
Yes, otherwise the C compiler would have complained.
My guess is that the pointer is converted to the char value zero.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
In article <15************ **************@ posting.google. com>, va*****@agilis. st.com.sg enlightened us with... Hi All, Is there anything wrong with this syntax..I am generating javascript code from "C" language.
unsigned char Buf="Test";
Um...
This isn't ANSI C.
An unsigned char is ONE character. Not a string.
Are you missing a pointer (*) or some brackets([]), or is this not ANSI C? If
this is C# or C++, mention that. :) but i have terminated this string in my "c" code..?
Are you SURE? ;)
--
--
~kaeli~
Condoms should be used on every conceivable occasion. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
Vanitha said: Hi All, Is there anything wrong with this syntax..I am generating javascript code from "C" language.
unsigned char Buf="Test"; printf("alert( \"%s\");\n\n",B uf);
I am getting error "Unterminat ed string literal in the javascript console
alert("Test
but i have terminated this string in my "c" code..?
The alert results look like you've got a newline character in Buf.
You don't show one in your example, but since your example is bad C syntax, I'm
guessing that you've wasted people's time by posting code that's "sorta like"
what you really have.
Sorry that was a typo error. I am assigning the string to a character
array only..I am using Mozilla browser. I am getting the error message
alert("Test Unterminated string literal in the Javascript console...
But actually i am terminating the string properly in my printf
statement for the alert message
kaeli <ti******@NOSPA M.comcast.net> wrote in message news:<MP******* *************** **@nntp.lucent. com>... In article <15************ **************@ posting.google. com>, va*****@agilis. st.com.sg enlightened us with... Hi All, Is there anything wrong with this syntax..I am generating javascript code from "C" language.
unsigned char Buf="Test";
Um... This isn't ANSI C. An unsigned char is ONE character. Not a string. Are you missing a pointer (*) or some brackets([]), or is this not ANSI C? If this is C# or C++, mention that. :)
but i have terminated this string in my "c" code..?
Are you SURE? ;)
--
Thanks for your replies. That solved the problem. It was the newline
char causing the problem.
I was actually copying some string to my buffer based on some
condition...
unsigned char au8RespBuf[40];
if(i32RetCode == SUCCESS)
{
strcpy(au8RespB uf,"Config set successfully\n" );
}else
{
//Decode the error code here....and form the correct error string
strcpy(au8RespB uf,"Config Failed\n");
}
Now when i remove the Newline char its working fine.sorry for the
confusion. next time onwards i will post the original code.
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: relaxedrob |
last post by:
Howdy All!
I am really stuck with this one - I want to completely create a table
within JavaScript and insert it into the document, with onMouseOut and
onMouseOver handlers in the table rows.
Below is a sample of the code I have created. It all works in Netscape
7.1, but in IE 6 it shows the table but the handlers do not run. I can
prove the handlers are even there (see the commented out alert command
in the code) so why aren't they...
|
by: Tommo |
last post by:
Hello All,
I am a still learning so be easy on me. I am trying to get
some code to work that is using JS and Perl/CGI, I am using AS Perl
and an Apache Server on XP as the webserver. Can anyone take a look at
the code and tell me why I am getting Apache Server errors in the code
below (Part A), when I modify the code as shown in part B the errors
go but the JS does not run ??
Part A.
|
by: johkar |
last post by:
I need to cancel the link and execute a function onclick of all the
links within the span tag which has a class of "container" assigned.
There will be only one span tag with this class applied.
I know you can get a specific tag using
document.getElementsByTagName('span'), but I am unsure how to get
the one with the class="container". I know there is a getAttribute
method, just need a pointer or two to put it all together. Once I know...
|
by: 4Ankit |
last post by:
Hey guys i am having some trouble with nesting one selection structure
within another selection structure. At the moment i am unclear what
selection structures are and just need a simple example of a selection
structure within another selection structure. I am supposed to use
function definitions with parameters to validate a form. my code for
what i have done so far is as follows(cropped):
function mainFunction() {
var dateFormat =...
|
by: Dan |
last post by:
Excuse me if i'm being a bit thick here, but is it possible to
reference a server side variable within an embedded js source file.
For example, my test.js file contains
alert('<%=tmpVar%>');
and my aspx page contains:-
<script type="text/javascript" src="test.js">
| |
by: webgour |
last post by:
Hello,
I would like to create an onload event within my object.
The following works fine :
function TEST()
{
this.image= new Image();
}
TEST.prototype.Initialize = function()
|
by: -Lost |
last post by:
I am calling setTimeout within the context of an object, and whilst this exists, it
refuses to be passed along to the function I call. For example:
$elemById('id').change = function()
{
// the function returns the object itself, 'this' exists
alert(this); //
setTimeout('alert(this);',1000); //
}
|
by: Morlaath |
last post by:
Is there a way to embed php within javascript code? I know that php is
server side and js is client side. For instance when working with jsp,
you can imbed jsp scriptlets within the js code.
e.g
<script language="javascript">
function foo() {
var bar = <%=(java variable)%>
|
by: DL |
last post by:
Hi,
What I wanted to do is to call a function from a newly created
element. But it stumbled me.
Here's the line that references the newly created element and I used
the alert function for debugging for now. Did I mess up all these
quotes?
// once again this is the key line of code, problem area, disregard
|
by: vunet |
last post by:
I am still not clear about how to reference an object within another
object to pass first object to a function:
var Parent = {
myFunc : function(){
alert("Parent = "+this)
},
Child : {
//how to get reference to Parent?
myChildFunc : function(){
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |