Converting a changing string to an integer

I need my Arduino to change a PWM output in accordance with a number being read off the serial port. It's exactly like the "Dimmer" example in the tutorials, except that on the PC end I have a program which outputs numbers (0-100) in ASCII strings instead of the nice integers the above Processing app puts out. Is there a way to convert? I've found a few things about the atoi function, but that seems to only convert constant characters and not variables. Also, I'm rather new to programming so please correct me if I used terminology wrong or some such. Thank you!

Hi Jake,

atoi does work on variable strings, but they must have a zero at the end. If you need help doing this, post the part of your code that receives the values and calls atoi.