 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Mon Sep 04, 2006 12:44 am Post subject: Error using sscanf |
|
|
Hi folks,
I get this err when trying to use sscanf:
| Code: | | warning: format '%f' expects type 'float *', but argument 3 has type 'double' |
with this code: | Code: | | sscanf((ReadBuffer+2), "%f%f%f",tmpObj->m_Vertices[ vc ].x, tmpObj->m_Vertices[ vc ].y, tmpObj->m_Vertices[ vc ].z); |
the wierd thing is that the m_Vertices is a float however for somereason it is not taken that way. Why is that?
here the code i use to create the tmpObj:
| Code: | typedef struct { float x, y, z; } ObjVertex; // the vertex
typedef struct { float x, y, z; } ObjNormal; // the normal
typedef struct { float u, v; } ObjTexCoord; // texture coordinates
typedef struct {
unsigned int *m_aVertexIndices,
*m_aNormalIndices,
*m_aTexCoordIndices;
unsigned int m_iVertexCount;
} ObjFace; // face
typedef struct _Mesh {
unsigned int iNumberOfGroups;
ObjVertex *m_Vertices;
ObjNormal *m_Normals;
ObjTexCoord *m_TexCoords;
ObjFace *m_Faces;
unsigned int *iSplit;
unsigned int m_iNumberOfVertices,
m_iNumberOfNormals,
m_iNumberOfTexCoords,
m_iNumberOfFaces;
} Mesh; | The tmpObj is a struct Mesh
any ideas? _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
Aion
Joined: 24 Jul 2006 Posts: 40 Location: Montreal
|
Posted: Mon Sep 04, 2006 1:31 am Post subject: |
|
|
You're passing the float value, not the adress of the variable.
Try this : &tmpObj->m_Vertices[ vc ].x instead. |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|