Results 1 to 2 of 2
Hi All,
How would I go about defining a variable from a document name. Example:
document01.doc
I want to take the 01 and set X to equal integer 1. Thanks ...
- 04-09-2010 #1
C++ Get Variable Name from Document Name
Hi All,
How would I go about defining a variable from a document name. Example:
document01.doc
I want to take the 01 and set X to equal integer 1. Thanks allBodhi 1.3 & Bodhi 1.4 using E17
Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17
"The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"
- 04-09-2010 #2
As you already know the extension, you begin by stripping ".doc" from the string.
Then you look, one character at a time, from the right side at each character.
You check each character whether it is a digit (isdigit) and stop if it is not.
This way you know there are two consecutive digits in this string. You strip the rest and transform the string to a integer number with atoi.Debian GNU/Linux -- You know you want it.


Reply With Quote