Note that there are some explanatory texts on larger screens.

plurals
  1. POc++ code throws unexpected characters in output
    primarykey
    data
    text
    <p>I have pasted a part of code snippet from my program, the output of the code gives some unrequired characters, please look into it and let me know the obvious logical reasons behind it.</p> <pre><code>class print { FILE *pFile; vector &lt;char&gt; st; public: char *formatForHtml(string str, string htmlTag) { string strBegin; strBegin = "&lt;"; strBegin.append(htmlTag); strBegin.append("&gt;"); strBegin.append(str); string strEnd = "&lt;/"; strEnd.append(htmlTag); strEnd.append("&gt;"); strBegin.append(strEnd); st.resize(strBegin.size()); for (int i =0;i &lt;strBegin.size();i++) { st[i] = strBegin[i]; } return &amp;st[0]; } void generatePath() { char fileName[_MAX_FNAME]; _makepath(fileName,"C:","\\Users\\vinitg\\Documents\\Visual Studio 2010\\Projects\\continous_beam_cpp.cpp\\", "myf9", "html"); pFile = fopen(fileName,"a+"); } void writeInFile() { string str = "DESIGN OF A CONTINOUS BEAM!"; char *procString; procString = formatForHtml(str, "p"); fprintf(pFile, procString); fclose(pFile); ShellExecute(NULL, "open", "file:///C:/Users/vinitg/Documents/Visual%20Studio%202010/Projects/continous_beam_cpp.cpp/myF9.html",NULL, NULL, SW_SHOWMAXIMIZED); } void passString (char g[]) { cout &lt;&lt; &amp;g[0]; } }; int main() { print generateReport; generateReport.generatePath(); generateReport.writeInFile(); cout &lt;&lt; "Press any one key to continue.."; getch(); }` </code></pre> <p>you must have already guessed that a HTML file created and results are displayed in html format, pasted below is the output(with unwanted characters)</p> <p><code>DESIGN OF A CONTINUOUS BEAM!</code></p> <p><code>ýýýý««««««««îþ</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload