forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error using sscanf

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Ghoti



Joined: 31 Dec 2005
Posts: 288

PostPosted: Mon Sep 04, 2006 12:44 am    Post subject: Error using sscanf Reply with quote

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
View user's profile Send private message
Aion



Joined: 24 Jul 2006
Posts: 40
Location: Montreal

PostPosted: Mon Sep 04, 2006 1:31 am    Post subject: Reply with quote

You're passing the float value, not the adress of the variable.

Try this : &tmpObj->m_Vertices[ vc ].x instead.
Back to top
View user's profile Send private message
Ghoti



Joined: 31 Dec 2005
Posts: 288

PostPosted: Tue Sep 05, 2006 10:34 pm    Post subject: Reply with quote

thanks it worked like a charm.
_________________
My PSP games:

Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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