Page 1 of 1

PostPosted: Sat Oct 09, 2004 11:16 pm
by jp68
I am very new to PocketC and almost as new to programing. I have been experimenting with some engineering utility models for work and decided that I wanted to spice up my programs using a GUI. Well I've hit a rock and can't seem to get around it:?:. Below is part of my code where the thing blows up. Hope some one can straighten me out:?:.

I think that I am getting a type mis-match becasue the Cgetcontent only returns a string and I'm trying to perform a mathamatical function on this variable.

How do I convert this string into a float or int variable??? and then back again to store it in one of my Chandle variables???


// Modulus of Rigidity main

//function prototype


//Define Global Variables

float E;
float r;
float MR;

//include auto-created files

include "Modulus of Rigidity controls (CEditor)"
include "Modulus of Rigidity methods (CEditor)"


title("Modulus of Rigidity");


//Define Variables

float E;
float r;
float MR;

//This is where my program blows up
// ModEast and PoissonsRatio Chandles from Cedit in my controls subroutine

E = Cgetcontent(ModElast);
r = Cgetcontent(PoissonsRatio);

// Somewhere in the above two lines I am getting a syntax error
// Cgetcontent returns a string and I need and int or float to do my computations
// How can convert???

MR = E/(2*(r+1));
format(MR, 0);

text(5, 130, "Modulus of Rigidity = " + MR + " ksi")


}// end Computation

PostPosted: Wed Oct 20, 2004 10:08 pm
by Atomo64
In my opinion he ccontrols lib is old and not very good if you want do really hard programs, that's why I do my own gui lib the best site