|
From: Jorge G. <jor...@gm...> - 2009-06-16 20:25:03
|
I need to generate random characters for experiment with string matching
algorithms , n=size of text nombreArchivo=filename, when n is small the code
below generate ascii characters, but when n is greater, (example n
=7000000), the code below generate chinesse characters, why?
sorry for my english :)
void crearArchivo(char* nombreArchivo, int n)
{
ofstream fSalida;
fSalida.open(nombreArchivo);
if(fSalida.is_open())
{
for(int i=0;i<n;i++)
{ char c=(char)rand();
fSalida<<c;
}
}
else
{
cout<<"el arhivo no se pudo crear";
}
fSalida.close();
}
int main()
{
crearArchivo("nuevo.txt",1000) ;
system("PAUSE");
return EXIT_SUCCESS;
}
--
Jorge
|