Hi, i'm very new here and very new to C. I'm trying to figure out how to encode and decode in my C class. i was given a two txt files to use. one is the decoding symbols and the other are the codes i need to decode.
i started out with

#include <stdio.h>


int main(void)
{
....
void getCode (int... );
void getMessage(int... );
void sortMessage(int ...);
void decodeMessage(int...);

....

i'm not sure if i need to put in the prototypes though i think i need to use arrays, i'm just confused. i want to make this as simple and clean as possible by using those but my problem is I really don't know where to start and what to put in getCode to start. Am I supposed to use the files given? any examples or just advice would help me out.

Well, it's clear that you don't understand you homework...
And we don't understand what's your problem too...
Why two files? What's a relation between function protorypes and arrays?
What's your encode (decode) method(s)?
And so on...

well, my problem is, is that i'm just not sure where to start. he gave me a file with the symbols i need to use to decode with (CIDJEUT&*W) and another file that has the codes in it, the ones that need to be decoded (12394, 18343, 12932).
i guess what i'm asking is the structure of this program. do i need use the given files (code.txt and message.txt) and use fopen to get the code? put fopen in getCode, then in getMessage do the same thing. essentially, putting fopen in getMessage too.

Of course, you must call fopen before you will get any file contents (then fclose the file). What's a question...
It does not matter where these calls placed: in the main routine or in a special function or what else...
It seems you have another problem. There are lots of methods to encode or to decode cipher text (or binary data). I can't understand what a method are you going to apply (and you? ). Obviously, this method defines your program structure. May be you can get a key file at first stage then decode message file as a stream (per char by char or line by line basis? ). May be it's a block cipher and you must get a whole message in the memory before you can decode it...

I wasn't entirely sure if the files he gave us were for our use (information) or to put in the program. i'm pretty sure i need to put in the files with fopen then decode them by char. so to start off in getCode i need to use fopen to "r"and then in get message i will use fopen again to "r"?
sorry if this is totally obvious to you, but thanks for being patient, it helps a lot.

Encoding and decoding is not so difficult.
encoding is done by just converting your text in particular form so that noone understands
for eg..
every letter has some ascii value add +3,+4,-5or any other coding in the ascii value.the resulting file will be a encoded file which is coded with a coding format..

and the same coding format is used to decode the text..and then the that file will be ur decoded file..

To open ur file u can use FOPEN which defined in the prototype stdio.h
for encoding and decoding u have to make ur own function...
by using that function u can encode and decode any txt file

I think this info might be useful to u..

This article has been dead for over six months. Start a new discussion instead.