Here is an example to directly answer your question:
Your question,"Importing C language variable to javascript".
I am not certain that I understand your explaination of the need, so I am attempting to answer the posted question itself directly.
C, or C++ code
const std::string SomeFile = "xyz.txt";
std::ifstream SomeStreamOfTheFile(SomeFile, std::ios_base::binary);
Would be converted to JavaScript as
<script language="JavaScript">
var nl = getNewLine()
function getNewLine() {
var agent = navigator.userAgent
if (agent.indexOf("Win") >= 0)
return "\r\n"
else
if (agent.indexOf("Mac") >= 0)
return "\r"
return "\r"
}
pagecode = 'const std::string SomeFile = "xyz.txt";
std::ifstream SomeStreamOfTheFile(SomeFile, std::ios_base::binary);
'
document.write(pagecode);
</script>
I noticed that there seems to be many thousands of people that read posts to this site and NEVER upvote ANY of them. I read some nice posts here and I try to upvote them if I like them. SHAME on you people that give no credit to at least an attempt to usefully answer a question. Shame on you. Those people are the definition of lurkers sucking the life from this site.
I got a -16 Authority Answer Downvoted for my answer. At least I tried. It looks like someone is so afraid of my answering questions that they piss their pants pissing a -16 at me. Maybe I should answer more. They did not even say who they were or even say what they found technically wrong with my answer. This is getting fun. Maybe I should look for more questions that I can offer (in my opinion) a userful answer.
Thank you.