strange problem - any ideas?

Posted By: kiamonster

strange problem - any ideas? - 12/14/08 23:00

STRING* sTitle = "";
STRING* sTitlt = " ";
STRING* namest = "na";

When I do a debug run, the first line is accepted, but when I put anything between the quotes, it errors with invalid character.
The syntax is fine I think - so why the error?
Posted By: HPW

Re: strange problem - any ideas? - 12/14/08 23:05

Do you declare the strings inside a function?
Only global string declaration is ok with this syntax.
For declaring inside a function the follow syntax should be used.
Code:
function my_func()
{
  STRING* namest;
  namest = str_create("na");
}

Posted By: kiamonster

Re: strange problem - any ideas? - 12/14/08 23:17

Thanks for the reply HPW
This is a global string or it should be!!!
It is in a script which only defines data items - no functions,

Posted By: HPW

Re: strange problem - any ideas? - 12/14/08 23:30

The syntax is correct for Lite-C (filename.c or filename.h) and global declaration.
Maybe it's an engine bug with the warn_level you use? I use warn_level = 1;
But it could also a syntax problem with a include before your declaration. Maybe somewhat like commentation at the end of a file or a include of a empty file. This is not allowed.
Posted By: HPW

Re: strange problem - any ideas? - 12/14/08 23:34

Do you also include in the first line of your main script one of this lines?
#include <acknex.h> // Pure Mode
or
#include <litec.h> // Legacy Mode
Posted By: kiamonster

Re: strange problem - any ideas? - 12/14/08 23:47

Thanks again HPW

I use acknex.h

Howecer, just moved it elsewhere - it failed - so I moved it back - it worked?
As Murphys' laws of programming state:
Does the damn thing work?
If yes then don't touch it!
Thanks again though. Very thoughtful.
© 2024 lite-C Forums