Cedit and Math Computations

Postby jp68 on Sat Oct 09, 2004 11:16 pm

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
Posts: 3
Joined: Fri Sep 10, 2004 1:10 am
Location: USA

Postby Atomo64 on Wed Oct 20, 2004 10:08 pm

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

http://www.atomo64.tk the best site
Posts: 45
Joined: Wed Feb 18, 2004 11:14 pm

Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 1 guest