hi everyone,
I am working on a program that calls another function, the other
function has some variables which unsigned char the
function that I am working on has some temporary char arrays
and it causing a lot of trouble specially when using fgets .
I am passing function callled encrypt( unsigned char *plain, unsigned char *cipher ) and I am passing two char arrays, I see that they are different but How do I get around this situation ?
Code:code void CipherText(FILE *infile, FILE *outfile ) { int count = 0; int i; ByteType plain[Max + 1]; ByteType cipher[Max + 1]; char str [Max]; ByteType *non_alpha_str; /* Read strings one by one from infile */ while (fgets (str, Max, infile) != NULL) { /* Convert each string to one without non-alpha characters */ non_alpha_str = get_alpha_str (str); for ( i = 0 ; i < Max; i++) { /* if characters read are 8, then we start processing */ if (count % 8 == 0) { /*copy the non_alpha_charcter to temporary array for procesing */ /*copy the non_alpha_charcter to temporary array for procesing */ cipher [0] = non_alpha_str[ i ]; cipher [1] = non_alpha_str[ i + 1 ]; cipher [2] = non_alpha_str[ i + 2 ]; cipher [3] = non_alpha_str[ i + 3 ]; cipher [4] = non_alpha_str[ i + 4 ]; cipher [5] = non_alpha_str[ i + 5 ]; cipher [6] = non_alpha_str[ i + 6 ]; cipher [7] = non_alpha_str[ i + 7 ]; cipher [8] = non_alpha_str[ i + 8 ]; cipher [9] = '\0'; /********** this function has 2 Bytetype rgumsents****/ Decrypt (cipher, plain ); --- /* for test purposes */ printf("%c", plain ); /* write it to output file */ if (fputs (plain, outfile) == EOF) { printf("Error while writing %s\n", plain); } fputs (plain, outfile); count = 0; } count++; } } }



LinkBack URL
About LinkBacks


