×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

(Borland C++) ¦¦ (Borland C++ Builder)

(Borland C++) ¦¦ (Borland C++ Builder)

(Borland C++) ¦¦ (Borland C++ Builder)

(OP)
Hello i'am a rookie here.

Which of the 2 is the best?

Which should i prefer and why?

Thank you!

RE: (Borland C++) ¦¦ (Borland C++ Builder)

Builder is a Rapid Application Development (RAD) program. That means it is easy to build Windows based programs. You just drag and drop the different components. Then you can write the code you want for the components and compile.

C++ is just the compiler and linker.

C++ version 5.5 is the SAME compiler that Builder 5 uses. Builder just makes it easier to use. The compiler is free, Builder co$t$.

James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.

RE: (Borland C++) ¦¦ (Borland C++ Builder)

(OP)
Thanks Very much!

Another problem i have is the following!

a) How can i deactivate Ctrl-Break and Ctrl-Alt-Delete in my C++ program so that the user who runs it cannot break it,escape from it or close it?

b) How does the following won't work in C++ Builder?

char s[11];

s=Edit1-Text;

c) How can i write a string to a Label1.Caption letter-by-letter? Is it possible to write directly to the form and not to the Label component?

d) Why this doesn't work?
if ((kbhit() && getch())==27) printf("You've hust hit Escape!");

e) Why tis doesn't work?
f ((f=fopen("C:\\DataBase.txt", "r"))==NULL)
    cprintf("To arxeio C:\\DataBase.txt den mporese na anoixtei gia diavasma!\a");
  else
  {
    while ((s[k++]=getch())!=27)
    {
      clrscr(); fseek(f, 0, SEEK_SET); i=0;

      while (fscanf(f, "%s %s %s", filos.onoma, filos.eponymo, filos.til)!=EOF)
        if (strstr(filos.onoma, s))
        {
          cprintf("%-15s%-20s%-15s\r\n", filos.onoma, filos.eponymo, filos.til);
          i++;
        }

      if (i==0)
        cprintf("No record found! Pata (Esc)...\a");
      else
        cprintf("\nFound %d record(s)!", i);
    }
  }

I want the program to when the user press keys to find them searching te field of the record starting from the beginning.

Fo example if the record is "Nikos" if the user presses N to show Nagia
        Nikos
        Nikitas
If it follows by an i
to show Nikos
        Nikitas
if Niko only Nikos

What cahnges do i have to make?

Thanks very much and sorry for the too much questions

I appreciate your help!

RE: (Borland C++) ¦¦ (Borland C++ Builder)

Sorry it has taken me some time to get back to you. I've been very busy at work. I haven't had time to research all your questions but here are some answers off the top of my head...

a) How can i deactivate Ctrl-Break and Ctrl-Alt-Delete in my C++ program so that the user who runs it cannot break it,escape from it or close it?
See http://www.bcbdev.com/faqs/faq82.htm

b) How does the following won't work in C++ Builder?
char s[11];
s=Edit1-Text;

I assume you mean s=Edit1->Text. There are several reasons. Borland's text boxes are AnsiStrings not character arrays. AFAIK, you cannot assign one character array to another with the = sign, you have to use something like strcpy. Only strings have the = sign overloaded for them. To assign a character array from a text box, you have to do something like:
char s[11];
AnsiString NewS = Edit1->Text;
int j = NewS.Length();
// If newS is too big, you will a buffer overrun (DANGEROUS)
if (j <= 10)
  strcpy(s, News.c_str());

Note that I check for a length of 10 since a character array always needs one place for the terminating character.

c) How can i write a string to a Label1.Caption letter-by-letter?
Your best bet is to put the characters to a string one by one and the put the string into the caption between each input of the letter.
Is it possible to write directly to the form and not to the Label component?Maybe but it might be more work that it is worth. I just don't know for certain.

d) Why this doesn't work?
if ((kbhit() && getch())==27) printf("You've hust hit Escape!");
e) Why tis doesn't work?
f ((f=fopen("C:\\DataBase.txt", "r"))==NULL)
    cprintf("To arxeio C:\\DataBase.txt den mporese na anoixtei gia diavasma!\a");
  else
  {
    while ((s[k++]=getch())!=27)
    {
      clrscr(); fseek(f, 0, SEEK_SET); i=0;

      while (fscanf(f, "%s %s %s", filos.onoma, filos.eponymo, filos.til)!=EOF)
        if (strstr(filos.onoma, s))
        {
          cprintf("%-15s%-20s%-15s\r\n", filos.onoma, filos.eponymo, filos.til);
          i++;
        }

      if (i==0)
        cprintf("No record found! Pata (Esc)...\a");
      else
        cprintf("\nFound %d record(s)!", i);
    }
  }

Are you trying to use this in a Windows GUI app? My notes on kbhit and getch is that you should not use these in Win32 GUI apps.

If you are trying to do this on a console or DOS app, it should work. Hope this was helpful

James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close