arun_raj7

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: MFC: changing int to string #3177
    arun_raj7
    Participant

    You can use any of c functions in c++ or mfc as long as you include the correct headers.
    Also I believe the correct syntax for that would be itoa(VartoShow,&ChatToConvert,10);
    You use the ampersand character to point to the string, you cant automatically put a string into a function parameter in accordance to how c++ conducts itself.

    in reply to: how to swap a string #3174
    arun_raj7
    Participant

    @ahsun
    Unless you are saving the source to the include directory and compiling from thereof, you need the brackets “<" & ">” around the include headers, not just quotes. Also, I am pretty sure he wasnt looking for a program to print two strings to output, Im pretty sure he was looking to get the string the user wanted to “swap” and then “swap” it.
    @chaitanya.b
    Im not sure quite how you mean. A program would have to use some major heuristics to be able to decipher something of that sort. Maybe you are talking about something that would do something like this:
    “hello im a string” 
    “string a im hello”

    If that is so then you can use strtok() to truncate the string to whitespace then print them in reverse order. If you wish to not use the library functions to reverse the string itself, you can write a strtok() function yourself and use it that way. Mainly, you would have to use homebrew functions to do the work for you, lets see if i can dig up some source code I may have laying around somewhere…
    Ok here are some examples of the functions, I dont remember who wrote them but I guess they work… I have never used them so dont expect anything great…
     

Viewing 2 posts - 1 through 2 (of 2 total)