[HELP] Converting unsigned int to char*

Hi, i need your help, i need converting unsigned int into char*

I have code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//      Struct                     Struct            char*    + class:uint32
	ModelTextureDef* texdef = (ModelTextureDef*)(f.getBuffer() + header.ofsTextures);
	if(header.nTextures)
	{
		textures = new TextureID[header.nTextures];

		for(size_t i = 0; i < header.nTextures; i++)
		{
			char texname[256];

			char* nameOfs;
                        //        struct[size_t].uint32 here i need convert!
			nameOfs = texdef[i].nameOfs;
			
			if(texdef[i].type == 0)
			{
                                // I need it convert because here i need use it!!!
				strncpy(texname, f.getBuffer() + *nameOfs, texdef[i].nameLen);
				texname[texdef[i].nameLen] = 0;
				string path(texname);
				fixname(path);
				textures[i] = video.textures.add(texname);
			}
There is itoa() standard C function for this or std::stringstream class if you prefer C++ approach.
itoa() isn't standard.
Or boost::lexical_cast if you prefer a simple, clean and fast C++ approach.
How i can use stringstream or boost? I use itoa but isnt work
Couldn't you use sprintf?
1
2
3
4
5
			char* nameOfs;
			
			if(texdef[i].type == 0)
			{
				sprintf(nameOfs, "%u", texdef[i].nameOfs);


Don't working? Some tips?

And give me example or repair me when i have it wrong
Topic archived. No new replies allowed.