misshyde misshyde - 3 months ago 22
C Question

how to character put together as a string in C

Here is my code. i am trying to write a text file all characters (=p). But it writes just one character.

Output is here:

Text you want to Encrypt : bahar

Result is true "naahd" but when i open text file i see just one character. "n" i couldnt find how fix it. Thank you.

  1. fclose(enc_vigenere); needs to be outside the for loop.

  2. This is not portable C. You cannot assume that a through to z appear in one block. (Ditto A to Z.) You also cannot assume that 65 is the value of A.

For (2) use int islower(int c) and int isupper(int c) instead. Those functions are portable.