Status
Not open for further replies.

Mo

New Member
1
2012
0
0
Hello,

For my first year project, I have to hide a message in a sound file, now my code doesn't work correctly so I was wondering if anyone can give me an insight on what is wrong? There's an encoder and decoder.

Encoder
Code:
#include <stdio.h>
#include "scc110io.h"
#include "scc110wav.h"

int main()

	{ 
        printf("This program has been coded to work for uncompressed PCM WAV files.");
        char *filename = AskForStringAndWait("Could you please enter the name of the audio file to be decoded?");
        printf("Chosen audio file: %s\n", filename);
        unsigned char *sounddata = LoadWavAudioFile(filename);
        int soundFileSize = GetSizeOfWavFile();
        if(soundFileSize != 0)
				{ 
				
                printf("\n");
                printf("Printing out hidden message, wait for it!\n");
                int SEQUENCE = 0;
				
                while(soundata[2 * SEQUENCE + 1] != 179) 
				
				{ 
				
                printf("%c", sounddata[2 * SEQUENCE + 1]); 
				
                SEQUENCE++; 
				
				} 
			}
		return 0;
				
}

Decoder
Code:
#include <stdio.h>
#include "scc110io.h"
#include "scc110wav.h"

int main()

{
    printf("This program has been coded to work for uncompressed PCM WAV files.");
    char *filename = AskForStringAndWait("Could you please enter the name of the audio file that you would like encoded");
    printf("Chosen audio file: %s\n", filename);
    printf("\n");
	
    unsigned char *sounddata = LoadWavAudioFile(filename);
	
    int AudioFileSize = GetSizeOfWavFile();

    if(AudioFileSize != 0)
	
	{
	
		char *msg = AskForStringAndWait("Could you please enter the message you would like encoded?");
		
		printf("Your chosen message: %s\n", msg);
		
		int SEQUENCE = 0;
		
		while(SEQUENCE < sizeof(messge)){
		
		sounddata[2 * SEQUENCE + 1] = messge[SEQUENCE]; 
		
		SEQUENCE++;
		}
	}
	
	return 0;

}
 
1 comment
check pm + send libraries so I can take a look.

also sequence can be abbreviated seq, esqnce, sequ, etc no need to use whole word etc. your indenting is quiet bad too, i can tell ur really new at c, so will help you on IM if you wish. read your code again too, shorten some of it the syntax/variables. you got some spelling mistakes like soundata and sounddata - when runned it will not work .. better you read book or stop coding.. not for you
 
Status
Not open for further replies.
Back
Top