Q:

I have some weird output instead of “blank space ” it appears unknown symbol in LaTeX

I'm writing code c++ in LaTeX using listing...but I have some weird output instead of "blank space " it appears unknown symbol, here is the code of the list:
\defverbatim[colored]\lstI{
\begin{lstlisting}[language=C++,basicstyle=\ttfamily\scriptsize,keywordstyle=\color{blue}\ttfamily,stringstyle=\color{red}\ttfamily,commentstyle=\color{green}\ttfamily,breaklines=true]
fprintf(gnuplot,"set term postscript\n");  
fprintf(gnuplot,"set output \"kmeans_graphs.ps\" \n");
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'init_center.dat' lt 7 linecolor rgb \"blue\"\n"); 
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'center_progress.dat' lt 7 linecolor rgb \"yellow\"\n");     
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'final_center.dat' lt 7 linecolor rgb \"green\"\n");
fprintf(gnuplot,"set term x11\n set out\n");
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'final_center.dat' lt 7 linecolor rgb \"green\"\n");
    cout<<"\tsaving all plots in the file directory with kmeans_graphs.ps name..."<<endl;
    cout<<"\tdisplaying final center for the data set..."<<endl;
\end{lstlisting}
}
\begin{frame}{partie 3 du code}{Extrait main.cpp}
\lstI
\end{frame}

Here is the output :
fprintf ( gnuplot , " set ␣ term ␣ postscript \ n " ) ;
fprintf ( gnuplot , " set ␣ output ␣ \" kmeans_graphs . ps \" ␣ \ n " ) ;
fprintf ( gnuplot , " plot ␣ ’ nomExt . txt ’␣ lt ␣ 3 ␣ linecolor ␣ rgb ␣ \" red
\" , ␣ ’ init_center . dat ’␣ lt ␣ 7 ␣ linecolor ␣ rgb ␣ \" blue \"\ n " ) ;
fprintf ( gnuplot , " plot ␣ ’ nomExt . txt ’␣ lt ␣ 3 ␣ linecolor ␣ rgb ␣ \" red
\" , ␣ ’ ce n te r_ pr o gr es s . dat ’␣ lt ␣ 7 ␣ linecolor ␣ rgb ␣ \" yellow \"\
n");
fprintf ( gnuplot , " plot ␣ ’ nomExt . txt ’␣ lt ␣ 3 ␣ linecolor ␣ rgb ␣ \" red
\" , ␣ ’ final_center . dat ’␣ lt ␣ 7 ␣ linecolor ␣ rgb ␣ \" green \"\ n " ) ;
fprintf ( gnuplot , " set ␣ term ␣ x11 \ n ␣ set ␣ out \ n " ) ;
fprintf ( gnuplot , " plot ␣ ’ nomExt . txt ’␣ lt ␣ 3 ␣ linecolor ␣ rgb ␣ \" red
\" , ␣ ’ final_center . dat ’␣ lt ␣ 7 ␣ linecolor ␣ rgb ␣ \" green \"\ n " ) ;
cout < < " \ tsaving ␣ all ␣ plots ␣ in ␣ the ␣ file ␣ directory ␣ with
␣ kmeans_graphs . ps ␣ name ... " << endl ;
cout < < " \ tdisplaying ␣ final ␣ center ␣ for ␣ the ␣ data ␣ set ...
" << endl ;

A:

The option showspaces=false and showstringspaces=false must be specified to the listing or as a global option.
\documentclass{beamer}
\usepackage{listings}%
\begin{document}

\lstset{showspaces=false,showstringspaces=false}%
\defverbatim[colored]\lstI{%
\begin{lstlisting}[language=C++,basicstyle=\ttfamily\scriptsize,keywordstyle=\color{blue}\ttfamily,stringstyle=\color{red}\ttfamily,commentstyle=\color{green}\ttfamily,breaklines=true]
fprintf(gnuplot,"set term postscript\n");  
fprintf(gnuplot,"set output \"kmeans_graphs.ps\" \n");
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'init_center.dat' lt 7 linecolor rgb \"blue\"\n"); 
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'center_progress.dat' lt 7 linecolor rgb \"yellow\"\n");     
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'final_center.dat' lt 7 linecolor rgb \"green\"\n");
fprintf(gnuplot,"set term x11\n set out\n");
fprintf(gnuplot,"plot 'nomExt.txt' lt 3 linecolor rgb \"red\", 'final_center.dat' lt 7 linecolor rgb \"green\"\n");
    cout<<"\tsaving all plots in the file directory with kmeans_graphs.ps name..."<<endl;
    cout<<"\tdisplaying final center for the data set..."<<endl;
\end{lstlisting}
}
\begin{frame}{partie 3 du code}{Extrait main.cpp}
\lstI%
\end{frame}

\end{document}

