Increment string value in VC++ 6.0
-
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
-
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
diptipanchal wrote:
The string would contain number only.
Then why not use numeric datatypes than string?
Navaneeth How to use google | Ask smart questions
-
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
sscanf should do the trick no?
-
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
You first have to convert it to an integer (how to do it depends on what you mean by "string" exactly), increment the integer and then convert it back to a string.
Cédric Moonen Software developer
Charting control [v2.0 - Updated] OpenGL game tutorial in C++ -
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
Well, it's simple:
- Convert the string to a numeric value.
- Increment the numeric value
- Convert back the numeric value to string
What are your troubles in doing that? :) Too slow Carlo, too slow... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
Why can you not just use an integer instead of exploring ways to misuse a string?
It is a crappy thing, but it's life -^ Carlo Pallini
-
i need to increment the string value in VC++ 6.0 MFC dialog based application. if the value of the string is 60 then it should get increment to 61. how can i achieve that. The string would contain number only. Pl suggest.
-
Why can you not just use an integer instead of exploring ways to misuse a string?
It is a crappy thing, but it's life -^ Carlo Pallini
Rajesh R Subramanian wrote:
exploring ways to misuse a string
Because abusing strings is always a lot more fun!
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh
-
Rajesh R Subramanian wrote:
exploring ways to misuse a string
Because abusing strings is always a lot more fun!
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh
Jim Crafton wrote:
Because abusing strings is always a lot more fun!
Well, exporing double roundings is even more fun... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Jim Crafton wrote:
Because abusing strings is always a lot more fun!
Well, exporing double roundings is even more fun... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Oh, you cut me low, you cut me really low... :cool:
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog Just Say No to Web 2 Point Oh
-
diptipanchal wrote:
The string would contain number only.
Then why not use numeric datatypes than string?
Navaneeth How to use google | Ask smart questions
I can not define that variable as int as i would need to store the variable value in txt file using CStdioFile. Using this class, it does not allow to store "int" value. *********** EXAMPLE **************** int m_barNo; cfile.WriteString(m_barNo); **************************************** if i try to store the int value using WriteString member function of CStdioFile, it gives an error as below "error C2664: 'WriteString' : cannot convert parameter 1 from 'int' to 'const char *' " Hence i would need to increment string..could anyone suggest how do i proceed...