!! BASIC question using c++ builder !!



Hey

i am using c++ builder and i was wondering how to add more strings to a line...
i.e
if i open a document that has 300,000 words in it and i wan't to add an 'a' at the begining of every word how would i go about doing this??

if you dont know how to in borland, i alos have microsoft visual c++ 5..

your help will be apresiated...thanks..
a1a2Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AlexVirochovskyConnect With a Mentor Commented:
No reply, I hope my explanation (see my 1-st comment)
is enuph. Alex
0
 
janivCommented:
U wanna change all the words, no exceptions ?
0
 
a1a2Author Commented:
Well i just made the example of changing the words to have a 'a' infront of it...

cause i have a document that contains many words...about over 300,000

they are the english dictonary, german and japanese...but only parts of them

and i wan't to put the name infront of each word so it is understandable....like the word english infront of all the english words...

i.e English -> "some english word"

so as you can see i dont wan't to type them in manually...
i understand that you would use a for loop, but i dont know how to position the cursor so i can add a string to the current text on that line with out over riding..

i hope ya guy's understand what i am trying to say
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
janivCommented:
How do U differ between english and other words ?
0
 
a1a2Author Commented:
hmm, umm dont worrie about that, its very hard to explane what i am trying to achieve in this program....

has anyone got any comments or solutions???

thanks
0
 
janivCommented:
There R many solution to this problem.
But I need to know the method.
How are the words are in the documnet?
0
 
janivCommented:
U can also send me a portion of the documnet via e-mail,
janivr@simigon.com
0
 
a1a2Author Commented:
its just a standard .txt document

i just want the ability to add text to the start of each line, with out over riding the current text in that file

if you can, i hope you can answer in terms of borland c++ builder, as i am kind of new to programming, and i asked my teacher and he couldn't figure it out...

i hope ya understand me
0
 
janivCommented:
Add the file to memory.
Search for '/n' (new line) in the buffer,
add after each '/n' the string that U want.
copy the buffer to a new file.

(of course, u'll need 2 buffers - (source and destination).
0
 
a1a2Author Commented:
oh...

is this using c++ builder??
0
 
janivCommented:
Add the file to memory.
Search for '/n' (new line) in the buffer,
add after each '/n' the string that U want.
copy the buffer to a new file.

(of course, u'll need 2 buffers - (source and destination).
0
 
janivCommented:
I don't think it matters.
It should work also in builder.
0
 
a1a2Author Commented:
ok, ill have a look, but sounds complicated...

i was hopeing i could use the RichEdit->Lines
and get the array out that way, ill have to do a bit of research on buffers by the sound of it...thanks :)
0
 
AlexVirochovskyCommented:
Next is process in C++ Builder
1. Load you file in TRichEdit (see LoadFromFile function)
  Something as:
  RichEdit1->Lines->LoadFromFile(OpenDialog->FileName);

2. Get number of lines
  n = RichEdit1->Lines->Counts
3.
  Make loop for all line
  for (intr i = 0; i < n ; i++)
   {
     tString myLine = RichEdit1->Lines[i];
    //now psevdo code:
      for every line get all words(use delimeters as
       ",. ?" )
     make new line
     Select current line
     change line to new line.
   }
all function for this you can easy find in RichEdit
class (and it will be usefull for you make it!).
0
 
AlexVirochovskyCommented:
a1a2???
0
 
a1a2Author Commented:
yeah?
0
 
AlexVirochovskyCommented:
a1a2, do you want more hints about your problem?
Full  BCB tutorial you can find in
http://matthewwu.163.net/c/bcmain.html
 
0
 
a1a2Author Commented:
sorry about no reply, just got back from holidays...
The method you told me, gave me something to do for a while...but i couldn't get it to work....

but when i was trying to sort out another problem, this arrose..and i found that the basic step was to do it this way

RichEdit1->Text = RichEdit1->Text + AnsiString("Blah") + ("blah");

so i included this in your statement, and all works sweet, thanks for tha info...

Later man
0
 
AlexVirochovskyCommented:
My code was psevdo code: ideas w/o exectly make you assignment.
>>RichEdit1->Text = RichEdit1->Text + AnsiString("Blah") + ("blah");
It is simple insert some text in end of TRichEdit.
Now, is my comment helps you?
0
 
a1a2Author Commented:
Yes i didn't know the command text
until the other day, it was for a school
assignment...

Like i said thanks for your time

later
0
 
MoondancerCommented:
I am sorry to see that Asker has not returned to update and finalize this question.  I am, therefore, force accepting this question.  In the event the Asker returns with additional needs related to this question, please respond and continue the collaboration process.
Thank you,
Moondancer
Community Support Moderator @ Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.