I have a console application in C ++ in Visual Studio Express 2013 with the following code:
#include <iostream>
#include <ostream>
using namespace std;
void GetValores(unsigned char* c)
{
// aquí va mucho código que asigna valores a otro puntero unsigned char llamado temp
int i = 0;
while (*temp != 'string str;
str.assign((char*)cadena, 256); // los valores se copian bien
cout << str;
') // copio los valores
{
c[i] = *temp;
temp++;
i++;
}
c[i] = 'std::ostream << str;
'; // le pongo el caracter nulo al final.
}
int _tmain(int argc, _TCHAR* argv[])
{
unsigned char* cadena = new unsigned char[256];
GetValores(cadena); // todo bien, recibo mis valores como debe ser
}
My problem is that now I want to print the values of cadena
on the screen.
I have tried with:
#include <iostream>
#include <ostream>
using namespace std;
void GetValores(unsigned char* c)
{
// aquí va mucho código que asigna valores a otro puntero unsigned char llamado temp
int i = 0;
while (*temp != 'string str;
str.assign((char*)cadena, 256); // los valores se copian bien
cout << str;
') // copio los valores
{
c[i] = *temp;
temp++;
i++;
}
c[i] = 'std::ostream << str;
'; // le pongo el caracter nulo al final.
}
int _tmain(int argc, _TCHAR* argv[])
{
unsigned char* cadena = new unsigned char[256];
GetValores(cadena); // todo bien, recibo mis valores como debe ser
}
but on line cout << str;
the compiler throws me the error: "no operator matches these commands, the operand types are std :: ostream <
but when I change it for:
%pre%now the compiler tells me "an identifier was expected", and it will not let me print my string.