The content of the file is read with the function mgetl() and stored in the local string variable inputString. The encoding function has three arguments:įileNameIn – string, representing the name and extension of the file where the text to be encoded is defined for our example is going to be 'fileTextWord.txt'įileNameOut – string, representing the name and extension of the file where the encoded message will be saved for our example is going to be 'fileTextEncoded.txt'ĮncodingType – string, representing the type of encoding of the message there are only three options: 'o' for octal, 'h' for hexadecimal and 'b' for binaryįirst we open the text file with the Scilab function mopen(). The encoding function is defined in the file encodeMessage.sci with the following Scilab instructions: function y=encodeMessage(fileNameIn,fileNameOut,encodingType) The message should be the same with the initial one from the file fileTextWord.txt. The result of the decoding is stored in the file fileTextDecoded.txt. To decode the message we’ll use the function decodeMessage(), which is reading the encoded message text file and converts back to Latin characters text. The encoded messages is going to be saved in the text file fileTextEncoded.txt. The function encodeMessage() will read the content of the text file and encode the character in either octal, hexadecimal or binary format. Our text message to be encoded will be defined in the text file fileTextWord.txt. Image: Text message encoding-decoding diagram
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |