Solved

This question is for shogi...

Posted on 1998-02-14
14
225 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Want to delete all my personal data 13 138
how to convert c++ code to Android App 3 83
Getting IP address 8 71
Better understanding on C++ Class serialization and formats 9 60
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now