Start New Discussion within our Software Development Community

Hi guys.
So, i'm suppose to make a translator, here's my form:
[IMG]http://img213.imageshack.us/img213/6067/12081833.jpg[/IMG]
When i press the middle button i have to check every word from left memo (MEMO1) and insert the translated word in the memo on the right (MEMO2).
So my middle button has the following code :

void __fastcall TForm1::BitBtn4Click(TObject *Sender)
{
AnsiChar *p;

Memo2->Lines->Clear();
p=strtok(Memo1->Text.c_str()," ,.-");
while (p != NULL)
{
Edit1->Text=p; //to see the word translated at the moment
if (p=="functie") Memo2->Text=Memo2->Text+"function ( )"; //function
if (p=="inceput") Memo2->Text=Memo2->Text+"{ "; //begin
if (p=="sfirsit") Memo2->Text=Memo2->Text+" }"; //end
if (p=="intreg") Memo2->Text=Memo2->Text+"integer "; //integer
//and so on...
p=strtok(NULL, " ,.-");
}        
}

As a result if i insert (in memo1) the text: "functie inceput sfirsit"
I should get (in memo2) the text : "function () { }"

The problem is i just don't get anything, and i meen not 1 word or even char, and edit1 contains this crap "dgdg¸U" (wtf ?).

So what the hell am i doing wrong ? Any help will be very apreciated.

I always recommend trying to abstract the problem. Here, your problem has nothing to do with translation. You simply want to know "How do I display a string in a text box?", right?

Unfortunately I don't do any windows gui programming, but surely someone can help if you post a tiny (< 20 line) example of a program that is supposed to put text in the text box but fails.

Dave

This article has been dead for over six months. Start a new discussion instead.