Solved

This question is for shogi...

Posted on 1998-02-14
14
229 Views
Last Modified: 2010-04-10
Hi, one more question.  How do I have it check to see if the last ten numbers are the ten numbers in regnum.dat / the amount of digits in the username (Edit2)? This will be added to the end of my edited codes.  For example if the number in regnum.dat is 250000000000 and the number of digits in the username (Edit2) is 5 the last ten digits will be 50000000000.

thanks,

steven
0
Comment
Question by:Perl_Man
  • 7
  • 7
14 Comments
 

Author Comment

by:Perl_Man
ID: 1182031
Edited text of question
0
 

Author Comment

by:Perl_Man
ID: 1182032
ps the / means devided by
0
 
LVL 2

Accepted Solution

by:
shogi earned 30 total points
ID: 1182033
Do not know if I understand you question, but I give you a sample code how to valid ...  I make my example with 11, because in your question you have 12 digits and it's seen you want the last 11.

Don't forget I'll not able to answer after sunday...for 1 week!

example :

// 1 edit1 field and 1 button to valid

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    int ValidationOk = 1;

    // here I will make a constant, but this number come from you file
    char ValidNumber[15] = "250000000000";
    // Here I give an example with a fixe number of chartere in the field
    char Text1[30];
    Edit1->GetTextBuf(Text1, 30);

    // testing size
    int SizeEdit = (Edit1->GetTextLen()) -1;
    int MAX_VALID = 11;   // 11 last number I want to valid
    int SizeValidNumber = strlen(ValidNumber) - 1;

    // validation
    for (; MAX_VALID>0 && SizeValidNumber>=0 && SizeEdit >= 0;
         MAX_VALID--,SizeValidNumber--, SizeEdit--)
    {
      if (ValidNumber[SizeValidNumber]!= Text1[SizeEdit])
         ValidationOk = 0;
    }

    if (ValidationOk && MAX_VALID==0)
         Application->MessageBox("I have a valid number",
                                  "Validation", MB_OK);
    else
         Application->MessageBox("Error: I don't have a valid number",
                                 "Validation", MB_OK);


}

0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Perl_Man
ID: 1182034
Ok I do not think u understand my question.  I will ahve my program randomaly generate a number (ten digits long) and save it in regnum.dat.  What I need you to do is make some codes up (for me to add to the end of the current validation codes) that will check to see if the last ten digits (in Edit1) are the same digits that are in regnum.dat devided by the number of digits in Edit2.  So basically you are taking a ten digit number and deviding it by the number of digits (charecters) in Edit2.  By doing this is will be a lot harder for someone to guess the shareware registration code.
0
 

Author Comment

by:Perl_Man
ID: 1182035
ps I looked at my question and I did type more than 10 digits (in the example) sorry about that..
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182036
Take a look to the code... if your Edit1 is my Edit1 and your number in your file it's my ValidNumber.  And MaX_VALID it's your max characters you want to valid.  My validation start to the end of Edit1 (your big validation code).

Here my understand:

in regnum = 4444444444

if in Edit2 I have 2 digits

regnum/2 = 2222222222

And you want that number

(2222222222) == The_Last_10_digit_of_my_MASK

it's that???.. feel sorry I have 48 hours without sleep, and I think my brain it's somewhere else :-)

If you need to speak me directly I'll be on IRC, with the same nickname shogi

0
 
LVL 2

Expert Comment

by:shogi
ID: 1182037
I'll take a look sunday afternoon...
0
 

Author Comment

by:Perl_Man
ID: 1182038
ok, yeah I do not think you understand.  please reply ASAP.
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182039
About my comment, what it's wrong??
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182040
I'm sorry I have to go, but I'll try to take a look monday if I can access internet (i'm really not sure)...
regards, shogi
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182041
Hi Perl_Man!!!
  I'm still around... but just 1 time by day until the end of the week.. so if you need more ... answer to the question I ask you.
Regards, Shogi
0
 

Author Comment

by:Perl_Man
ID: 1182042
Ok what I need is someway to see if the last 10 digits entered to Edit2 = regnum.dat (there will be 10 digits in it) / the number of charecters in Edit1.  Do you understand????  I also need this ASAP.  My program will be on the market March 1 and need it to be completed!
0
 
LVL 2

Expert Comment

by:shogi
ID: 1182043
just btw, in your edit1 it's not the MASK (Fix number of char) ?
0
 

Author Comment

by:Perl_Man
ID: 1182044
i do not understand.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

770 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