Click here to Skip to main content
15,909,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Anything wrong with this? Pin
James R. Twine24-Jan-05 3:37
James R. Twine24-Jan-05 3:37 
GeneralSendMessage Pin
Yulianto.23-Jan-05 21:54
Yulianto.23-Jan-05 21:54 
GeneralRe: SendMessage Pin
ThatsAlok23-Jan-05 22:21
ThatsAlok23-Jan-05 22:21 
GeneralRe: SendMessage Pin
ThatsAlok23-Jan-05 22:22
ThatsAlok23-Jan-05 22:22 
GeneralRe: SendMessage Pin
Yulianto.23-Jan-05 22:50
Yulianto.23-Jan-05 22:50 
GeneralRe: SendMessage Pin
ThatsAlok23-Jan-05 23:42
ThatsAlok23-Jan-05 23:42 
GeneralRe: SendMessage Pin
Mircea Puiu23-Jan-05 22:42
Mircea Puiu23-Jan-05 22:42 
GeneralOutput formatting Pin
hugPW23-Jan-05 21:31
hugPW23-Jan-05 21:31 
I have nearly finished my little beginners project and need help in formatting the output my code is below. My question is after the code

/////////////////////////////////////////////////////////////////////////////
// CReverseView message handlers

void CReverseView::OnReverse()
{

// TODO: Add your command handler code here
CEdit &edit = GetEditCtrl();

CString strText;
CString msg = "\r\nThe answer is ";
CString data; // storage for the read in data'
CString line; // to concactenate msg & data

BYTE a;

edit.GetWindowText(strText);

while (!strText.IsEmpty())
{

sscanf(strText,"%c",&a); //read the char

data = (BYTE)a; // put it in data

strText=(const char*)strText1;+1
// move the pointer


line = msg+=data;
// add CR/LF "The message is" to the beginning

}

strText = line;

edit.SetWindowText(strText);
//This prints The answer is qwerty

GetDocument()->SetModifiedFlag(TRUE) ;

}

The above code prints
The answer is qwerty


I want it to print out like this:-

The answer is q
The answer is w
The answer is e
The answer is r
The answer is t
The answer is y

It seems my string objects over write each other. How do I fix this or re set the "object counter" back to zero so that it overwrites the existing data? I have tried many ways but can't work it out

Thank you Smile | :)

GeneralRe: Output formatting Pin
David Crow24-Jan-05 2:49
David Crow24-Jan-05 2:49 
GeneralRe: Output formatting Pin
hugPW24-Jan-05 3:12
hugPW24-Jan-05 3:12 
GeneralRe: Output formatting Pin
David Crow24-Jan-05 3:25
David Crow24-Jan-05 3:25 
GeneralRe: Output formatting Pin
hugPW24-Jan-05 5:40
hugPW24-Jan-05 5:40 
GeneralRe: Output formatting Pin
David Crow24-Jan-05 9:02
David Crow24-Jan-05 9:02 
GeneralRe: Output formatting Pin
hugPW24-Jan-05 5:43
hugPW24-Jan-05 5:43 
QuestionHow to open USB port? Pin
eli1502197923-Jan-05 21:12
eli1502197923-Jan-05 21:12 
AnswerRe: How to open USB port? Pin
Cedric Moonen23-Jan-05 21:32
Cedric Moonen23-Jan-05 21:32 
GeneralRe: How to open USB port? Pin
eli1502197923-Jan-05 21:44
eli1502197923-Jan-05 21:44 
GeneralRe: How to open USB port? Pin
Cedric Moonen23-Jan-05 21:55
Cedric Moonen23-Jan-05 21:55 
AnswerRe: How to open USB port? Pin
namaskaaram24-Jan-05 1:43
namaskaaram24-Jan-05 1:43 
Generalchar to int Pin
doneirik23-Jan-05 20:15
doneirik23-Jan-05 20:15 
GeneralRe: char to int Pin
Cedric Moonen23-Jan-05 21:05
Cedric Moonen23-Jan-05 21:05 
GeneralRe: char to int Pin
doneirik23-Jan-05 21:27
doneirik23-Jan-05 21:27 
GeneralRe: char to int Pin
toxcct23-Jan-05 21:59
toxcct23-Jan-05 21:59 
GeneralSHCreateDirectory() Pin
Monisankar23-Jan-05 20:01
Monisankar23-Jan-05 20:01 
GeneralRe: SHCreateDirectory() Pin
ThatsAlok23-Jan-05 20:09
ThatsAlok23-Jan-05 20:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.