About use sprintf vex function converts a int to a string.

   8504   0   0
User Avatar
Member
17 posts
Joined: 7月 2007
Offline
hi all, i use vex sop add a string attribute(neighbourpoints) to default grid, but the result isnt expected, every point attribute have a number 10, like that,
any help?
thanks,


sop
vopsop1()
{
int count = getneighbourcount(ptnum, 0);
string temp = “”;
int test=0;

int i;
for(i=0; i < count; i +=1 )
{
int neighptnum = getneighbour(ptnum, i, 0);
temp+=sprintf(“%d ”,neighptnum);
test+=neighptnum;
}
printf(“%s ”,test);
addattribute(“neighbourpoints”, temp);
}


the “test” variable export is right:
11 13 16 19 22 25 28 31 34 27 31 44 48 …

Attachments:
string attribute.hipnc (52.0 KB)
neighbourpoints.jpg (7.8 KB)

  • Quick Links