need to wrap the alphabet

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>


/*
* Matthew kidd
* Date 10/12/2010
* a program to load user specified file into an array
*/


void main()
{
FILE *file_in;
FILE *file_out;
char alphabet[] = "abcdefghijklmnopqrstuvwxyz";

char file_in_name[999];
printf("Enter text file to encrypt . . . ");
scanf("%s", file_in_name);

int key;
printf("Enter the key you want to use . . . ");
scanf("%d", &key);

while (key>-27, key>27)
{
printf("please enter a new value for the key . . . ");
scanf("%d", &key);
}

char file_out_name[999];
printf("Enter an output file name . . . ");
scanf("%s", file_out_name);

file_in = fopen(file_in_name, "r");
file_out = fopen(file_out_name, "w");

int fpointer;
fpointer = getc(file_in);


while (fpointer != EOF)
{
fpointer += key;
fprintf(file_out, "%c", fpointer);
fpointer = getc(file_in);
}


fprintf(file_out, "\nthe key you used was %d", key);
fclose(file_in);
fclose(file_out);
}


this code works fine except that only letters are allowed in the output so i need to make the character after z be a
Last edited on
Topic archived. No new replies allowed.