|
-
May 3rd, 2004, 07:23 PM
#1
Thread Starter
Addicted Member
Manipulating String (Resolved)
VB Code:
Dim strRecievedMessage as String
For i = 1 To Len(strMessage)
strRecievedMessage = strRecievedMessage & (Chr(Asc(Mid(strMessage, i, 1)) - 10))
Next i
This gives me runtime error '5', Invalid Procedure Call or Argument. It just moves the ASCII value down 10, what is the problem?
Last edited by jeb2022; May 3rd, 2004 at 07:49 PM.
-
May 3rd, 2004, 07:27 PM
#2
So Unbanned
Hmmm...
If the character's ASCii is below 10 it'd error, thus you'd have an invalid Call, because the argument would be invalid.
-
May 3rd, 2004, 07:28 PM
#3
Thread Starter
Addicted Member
When it's below 10 should i have it loop back up to the top of the ASCII chart, and have it come down to 10 when it's about 128 or whatever?
-
May 3rd, 2004, 07:29 PM
#4
if strMeassge contains anything less than Chr(10), you'll get that error because the result would be a negative and of course that's not valid.
-
May 3rd, 2004, 07:30 PM
#5
Fanatic Member
can you post the values of the variables when it crashed?
"Knowledge is gained when different people look at the same information in different ways"
- Louis Pasteur
-
May 3rd, 2004, 07:33 PM
#6
Thread Starter
Addicted Member
strMessage = ""
That might be the problem.
-
May 3rd, 2004, 07:35 PM
#7
Fanatic Member
impossible...you'd never get inside the for loop
"Knowledge is gained when different people look at the same information in different ways"
- Louis Pasteur
-
May 3rd, 2004, 07:37 PM
#8
Thread Starter
Addicted Member
VB Code:
sckMain.GetData strMessage 'recieves the sent data
MsgBox strMessage
'Decrypts
For i = 1 To Len(strMessage)
strRecievedMessage = strRecievedMessage & (Chr(Asc(Mid(strMessage, i, 1)) - 10))
Next i
The message box shows nothing, however, when I debug, and mouse over strMessage, it shows me boxes, that are probably for illegal characters.
-
May 3rd, 2004, 07:41 PM
#9
So Unbanned
Worst encryption ever.
Anyway...
Set the ASC of the char to say: x
If x < 10 then x = 255 + x
'do your thing with x
Conversely:
If x > 245 then x = x - 255
'do your thing with x
-
May 3rd, 2004, 07:44 PM
#10
Thread Starter
Addicted Member
What, you don't like my little ASCII encryption? I really didn't feel like doing RC4 or something nice.
Let me try this code.
-
May 3rd, 2004, 07:47 PM
#11
Thread Starter
Addicted Member
Okay, so, it appears as if my buddy and I were trying to connect to something else. We had the wrong IP. (we're using port 1337 for kicks, so we're gonna get someone to send something to us.)
I guess this is resolved. Thanks DigitalError and everyone else.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|