Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Builder 3 - Getting data input from user, Tedit

Posted on 1998-12-20
1
291 Views
Last Modified: 2008-02-20
I am using Builder and have a problem getting data from the VCL, I want to do something like this, strcpy(name,Edit1->Text); this does not work but this does Edit2->Text = Edit1->Text; I need to initialise variable using the Tedit or other BCB3 component. In C++ I would have used cin>> or scanf();. I have tried searching for sample Code but have foound all the Sample Code Available mouse click driven with no real data comming  from the operator.
Can any one help me,

DAVID
0
Comment
Question by:dj1encore
1 Comment
 

Accepted Solution

by:
plsbctv earned 10 total points
ID: 1180687
I assume that name is declared as
  char name[...];
In other words, name is type char *.

strcpy (name,Edit1->Text)
fails because Edit1->Text is type AnsiString, not char *.

You can do this by writing

strcpy (name, (Edit1->Text).c_str());

    ++PLS

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question