Converting a string into numbersMIPS: determine if a list of test scores are pass/failMIPS: Check how many alphabetic characters are in a stringHow do I find the mode digit with the least number of instruction counts?MIPS assembly language printing out each int of array line by lineMultiplying and Combining MatricesPrinting 10 characters from a String at a time in MIPSHow to remove a comma from string inputMIPS code doesn't print strings loaded from memoryMIPS reverse order of Capital Letters in each word in stringMIPS : parsing and modifying a string
How to project 3d image in the planes xy, xz, yz?
Passing multiple files through stdin (over ssh)
Words that signal future content
Find the Factorial From the Given Prime Relationship
Is the term 'open source' a trademark?
Frame failure sudden death?
How do governments keep track of their issued currency?
How did students remember what to practise between lessons without any sheet music?
How to retract an idea already pitched to an employer?
Which comes first? Multiple Imputation, Splitting into train/test, or Standardization/Normalization
What could have caused a rear derailleur to end up in the back wheel suddenly?
Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?
What can plausibly explain many of my very long and low-tech bridges?
Comparing and find out which feature has highest shape area in QGIS?
How does a transformer increase voltage while decreasing the current?
How did they achieve the Gunslinger's shining eye effect in Westworld?
How "pissed" come to mean "drunk" or "angry"?
Genetic limitations to learn certain instruments
Compiling c files on ubuntu and using the executable on Windows
What's the name of this light airplane?
Watts vs. Volt Amps
What language is the software written in on the ISS?
What does the "c." listed under weapon length mean?
Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?
Converting a string into numbers
MIPS: determine if a list of test scores are pass/failMIPS: Check how many alphabetic characters are in a stringHow do I find the mode digit with the least number of instruction counts?MIPS assembly language printing out each int of array line by lineMultiplying and Combining MatricesPrinting 10 characters from a String at a time in MIPSHow to remove a comma from string inputMIPS code doesn't print strings loaded from memoryMIPS reverse order of Capital Letters in each word in stringMIPS : parsing and modifying a string
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
# replacing all digits in a string with their complement in 9.
.data
string: .asciiz "123471863"
.text
main:
# load string's 1st address into the memory
la $a0, string
# initialize the loop-counter
li $t0, 0
li $t1, 9 # complement envelope for later use
# start the loop
start_loop:
lb $t2, ($a0) # Take one character from string
# loop termination condition
beq $t2, $zero, end_loop # terminate if null-value found
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
sw $t2,($a0) # restore the string-byte content
addi $a0, $a0, 1 # go to next string-byte
addi $t0, $t0, 1 # increment loop-counter
j start_loop
end_loop:
# print string
la $a0, string # load 1st address of the string
li $v0, 4 # syscall for string print
syscall
move $a0, $t0 # load 1st address of the string
li $v0, 1 # syscall for string print
syscall
# exit program
li $v0, 10
syscall
The program isn't working as expected. After 1st iteration, the $a0
register isn't giving the correct value. Apparently, sw $t2,($a0)
is destroying the original address.
How can I get over this issue?
assembly mips
add a comment |
# replacing all digits in a string with their complement in 9.
.data
string: .asciiz "123471863"
.text
main:
# load string's 1st address into the memory
la $a0, string
# initialize the loop-counter
li $t0, 0
li $t1, 9 # complement envelope for later use
# start the loop
start_loop:
lb $t2, ($a0) # Take one character from string
# loop termination condition
beq $t2, $zero, end_loop # terminate if null-value found
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
sw $t2,($a0) # restore the string-byte content
addi $a0, $a0, 1 # go to next string-byte
addi $t0, $t0, 1 # increment loop-counter
j start_loop
end_loop:
# print string
la $a0, string # load 1st address of the string
li $v0, 4 # syscall for string print
syscall
move $a0, $t0 # load 1st address of the string
li $v0, 1 # syscall for string print
syscall
# exit program
li $v0, 10
syscall
The program isn't working as expected. After 1st iteration, the $a0
register isn't giving the correct value. Apparently, sw $t2,($a0)
is destroying the original address.
How can I get over this issue?
assembly mips
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36
add a comment |
# replacing all digits in a string with their complement in 9.
.data
string: .asciiz "123471863"
.text
main:
# load string's 1st address into the memory
la $a0, string
# initialize the loop-counter
li $t0, 0
li $t1, 9 # complement envelope for later use
# start the loop
start_loop:
lb $t2, ($a0) # Take one character from string
# loop termination condition
beq $t2, $zero, end_loop # terminate if null-value found
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
sw $t2,($a0) # restore the string-byte content
addi $a0, $a0, 1 # go to next string-byte
addi $t0, $t0, 1 # increment loop-counter
j start_loop
end_loop:
# print string
la $a0, string # load 1st address of the string
li $v0, 4 # syscall for string print
syscall
move $a0, $t0 # load 1st address of the string
li $v0, 1 # syscall for string print
syscall
# exit program
li $v0, 10
syscall
The program isn't working as expected. After 1st iteration, the $a0
register isn't giving the correct value. Apparently, sw $t2,($a0)
is destroying the original address.
How can I get over this issue?
assembly mips
# replacing all digits in a string with their complement in 9.
.data
string: .asciiz "123471863"
.text
main:
# load string's 1st address into the memory
la $a0, string
# initialize the loop-counter
li $t0, 0
li $t1, 9 # complement envelope for later use
# start the loop
start_loop:
lb $t2, ($a0) # Take one character from string
# loop termination condition
beq $t2, $zero, end_loop # terminate if null-value found
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
sw $t2,($a0) # restore the string-byte content
addi $a0, $a0, 1 # go to next string-byte
addi $t0, $t0, 1 # increment loop-counter
j start_loop
end_loop:
# print string
la $a0, string # load 1st address of the string
li $v0, 4 # syscall for string print
syscall
move $a0, $t0 # load 1st address of the string
li $v0, 1 # syscall for string print
syscall
# exit program
li $v0, 10
syscall
The program isn't working as expected. After 1st iteration, the $a0
register isn't giving the correct value. Apparently, sw $t2,($a0)
is destroying the original address.
How can I get over this issue?
assembly mips
assembly mips
edited Mar 24 at 16:53
user366312
asked Mar 24 at 16:18
user366312user366312
4,03947162321
4,03947162321
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36
add a comment |
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36
add a comment |
1 Answer
1
active
oldest
votes
There is no problem to differentiate a null and a '0'. null is 0, while '' is 48.
Your test
beq $t2, $zero, end_loop # terminate if null-value found
is perfectly correct and will detect the end of string.
What is incorrect is you algorithm.
A way to complement a number in C, would be :
while(c=*str)
c=c-'0' ; // transform the number to integer
c=9-c; // complement it
c += '0'; // add 48 to turn it back to a character
str++;
You are missing the last conversion to character.
If you change
sub $t2, $t1, $t2 # apply complement to $t2
to
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
all should work.
Alternatively, ou can simplify your algorithm and remark that the computation c=9-(c-48)+48
is equivalent to c=105-c
. Add before start_loop
li $t4 105 ##
and replace the three lines
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
by
sub $t2,$t4,$t2 # complement to 9 directly on char representing the digit
li $t4 105 ##
?
– user366312
Mar 24 at 17:17
Ooops, a comma is missing.li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.
– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325865%2fconverting-a-string-into-numbers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is no problem to differentiate a null and a '0'. null is 0, while '' is 48.
Your test
beq $t2, $zero, end_loop # terminate if null-value found
is perfectly correct and will detect the end of string.
What is incorrect is you algorithm.
A way to complement a number in C, would be :
while(c=*str)
c=c-'0' ; // transform the number to integer
c=9-c; // complement it
c += '0'; // add 48 to turn it back to a character
str++;
You are missing the last conversion to character.
If you change
sub $t2, $t1, $t2 # apply complement to $t2
to
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
all should work.
Alternatively, ou can simplify your algorithm and remark that the computation c=9-(c-48)+48
is equivalent to c=105-c
. Add before start_loop
li $t4 105 ##
and replace the three lines
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
by
sub $t2,$t4,$t2 # complement to 9 directly on char representing the digit
li $t4 105 ##
?
– user366312
Mar 24 at 17:17
Ooops, a comma is missing.li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.
– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
add a comment |
There is no problem to differentiate a null and a '0'. null is 0, while '' is 48.
Your test
beq $t2, $zero, end_loop # terminate if null-value found
is perfectly correct and will detect the end of string.
What is incorrect is you algorithm.
A way to complement a number in C, would be :
while(c=*str)
c=c-'0' ; // transform the number to integer
c=9-c; // complement it
c += '0'; // add 48 to turn it back to a character
str++;
You are missing the last conversion to character.
If you change
sub $t2, $t1, $t2 # apply complement to $t2
to
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
all should work.
Alternatively, ou can simplify your algorithm and remark that the computation c=9-(c-48)+48
is equivalent to c=105-c
. Add before start_loop
li $t4 105 ##
and replace the three lines
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
by
sub $t2,$t4,$t2 # complement to 9 directly on char representing the digit
li $t4 105 ##
?
– user366312
Mar 24 at 17:17
Ooops, a comma is missing.li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.
– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
add a comment |
There is no problem to differentiate a null and a '0'. null is 0, while '' is 48.
Your test
beq $t2, $zero, end_loop # terminate if null-value found
is perfectly correct and will detect the end of string.
What is incorrect is you algorithm.
A way to complement a number in C, would be :
while(c=*str)
c=c-'0' ; // transform the number to integer
c=9-c; // complement it
c += '0'; // add 48 to turn it back to a character
str++;
You are missing the last conversion to character.
If you change
sub $t2, $t1, $t2 # apply complement to $t2
to
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
all should work.
Alternatively, ou can simplify your algorithm and remark that the computation c=9-(c-48)+48
is equivalent to c=105-c
. Add before start_loop
li $t4 105 ##
and replace the three lines
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
by
sub $t2,$t4,$t2 # complement to 9 directly on char representing the digit
There is no problem to differentiate a null and a '0'. null is 0, while '' is 48.
Your test
beq $t2, $zero, end_loop # terminate if null-value found
is perfectly correct and will detect the end of string.
What is incorrect is you algorithm.
A way to complement a number in C, would be :
while(c=*str)
c=c-'0' ; // transform the number to integer
c=9-c; // complement it
c += '0'; // add 48 to turn it back to a character
str++;
You are missing the last conversion to character.
If you change
sub $t2, $t1, $t2 # apply complement to $t2
to
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
all should work.
Alternatively, ou can simplify your algorithm and remark that the computation c=9-(c-48)+48
is equivalent to c=105-c
. Add before start_loop
li $t4 105 ##
and replace the three lines
subi $t2, $t2, 48 # convert it to a digit
sub $t2, $t1, $t2 # apply complement to $t2
addi $t2, $t2, 48
by
sub $t2,$t4,$t2 # complement to 9 directly on char representing the digit
answered Mar 24 at 17:11
Alain MerigotAlain Merigot
5,1992922
5,1992922
li $t4 105 ##
?
– user366312
Mar 24 at 17:17
Ooops, a comma is missing.li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.
– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
add a comment |
li $t4 105 ##
?
– user366312
Mar 24 at 17:17
Ooops, a comma is missing.li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.
– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
li $t4 105 ##
?– user366312
Mar 24 at 17:17
li $t4 105 ##
?– user366312
Mar 24 at 17:17
Ooops, a comma is missing.
li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.– Alain Merigot
Mar 24 at 17:25
Ooops, a comma is missing.
li $t4,105
The problem is that you can subtract an immediate from a register, but not subtract a register from an immediate in an instruction. So you put the immediate 105 in a register before the loop to perform the subtraction in an instruction.– Alain Merigot
Mar 24 at 17:25
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
If you change sub $t2, $t1, $t2 # apply complement to $t2 to sub $t2, $t1, $t2 # apply complement to $t2 addi $t2, $t2, 48 all should work. --- nope. doesn't work.
– user366312
Mar 24 at 17:30
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Onec corrected, your algorithm really seems correct, but I do not have time to test it. Maybe the problem comes from branches. Are your branches delayed ?
– Alain Merigot
Mar 24 at 17:37
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
Are your branches delayed? --- nope.
– user366312
Mar 24 at 17:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325865%2fconverting-a-string-into-numbers%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"null", in the sense of the comment, is a zero value. For handling strings with embedded zero bytes (i.e. strings where the characters can be any byte value) you need to use a different way of encoding strings, the most common being to prefix the string with a length value.
– Josh Greifer
Mar 24 at 16:28
@JoshGreifer, how to do that?
– user366312
Mar 24 at 16:32
Well, that's another question which you can post here - but I suggest you first look for questions here on "pascal strings"
– Josh Greifer
Mar 24 at 16:34
@JoshGreifer, "that's another question which you can post here" --- this is not another question. On the basis of your comment, this is already part of this question.
– user366312
Mar 24 at 16:36