oh the wonders of being a noob. I tried adjusting the code in the link and utilizing it in my code in different parts, but now it doesnt return anything. i dont get any text back now.
Code:
#include <stdio.h>
#include <string.h>
/*encode function, to encode user input */
int main()
{
char buff[BUFSIZ];
int i = 0;
int shift_value;
int p = 0;
char *r;
printf( "**initializing.....**\n\n"
"**linking..........**\n\n");
printf( "Welcome agent Brown\n\n");
printf( "You have accessed the Caesar Cipher program\n\n");
printf("\nPlease enter the text you wish to encrypt: ");/*accept user input */
fgets(buff, sizeof(buff), stdin);
printf("\nEnter your encryption shift value (anything from +-1 to 25): ");
scanf ("%i", &shift_value);
{
while ( buff[i] != '\0' )
{
buff[i] = buff[i] + shift_value + i++;
}
}
if (fgets(buff, sizeof(buff), stdin) != NULL)
{
if ((r = strchr(buff, '\n')) != NULL)
*r = '\0';
printf("\nYour encrypted text is:%s\n",buff);/*return encrypted text */
}
return 0; /* indicate successful completeion */
}