create HTML file



  • Hi people!
    I am trying to create a HTML file source with JScript using c++ language, but this code don't work:

    #include <stdio.h>
    int main ()
    {
    FILE * pFile;
    pFile = fopen ("myfile.html","wt");
    if (pFile!=NULL)
    {
    fputs ("fopen example",pFile);
    fclose (pFile);
    }
    return 0;
    }

    ➡ it return a error when I put HTML code their:

    #include <stdio.h>
    int main ()
    {
    FILE * pFile;
    pFile = fopen ("myfile.html","wt");
    if (pFile!=NULL)
    {
    fputs ("<script language="JavaScript">;",pFile);
    fclose (pFile);
    }
    return 0;
    }

    I think it happen because HTML and JS has ("") and c/c++ think it is a end function. Could anyone know a better away to create a HTML file?
    thx!



  • entweder machst du aus " folgendes zeichen ' (dies wird von html auch akzeptiert)
    oder \"(oder war es /") beides ist jedenfalls möglich und sollte funktionieren



  • could you or anyone give me a example? because I can't do it.

    😕

    how to put this source:

    Set js = CreateObject("WScript.Shell")
    

    in a file?

    thx 👍



  • fputs("Set js = CreateObject(\"WScript.Shell\")");
    


  • ohhhh ok!!!!! Now I understand!
    thx guys! 👍


Anmelden zum Antworten