How to encrypt text files in c


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to encrypt text files in c

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Posts
    1

    How to encrypt text files in c

    Hi
    I've written a program that reads and prints text files that the user has chosen. I now want the program to encrypt the text in the file and for the user be able to choose the alphabetic shift. Could someone please show me how to do this? Here is what i have so far:
    Code:
    #include <stdio.h>
    
    int main(void) {
    FILE *file_in;
    char filename[20];
    char ch;
    int shift;
    // file_in is the name given to the stream. filename will be the file that the user chooses. ch is the characters in the file.
    
    
    printf("What file do you want to open?: ");
    gets(filename);
    	file_in=fopen(filename, "r");
    	//ask the user to enter the name of a file
    
    if(file_in==NULL)
    printf("Error! File did not open.\n");
    	//print message if the file can not be found
    
    while((ch=fgetc(file_in)) != EOF) 
    putchar(ch);
    	//prints the results on the screen and shows the end of the file
    fclose(file_in);
    	//closes stream
    }

  2. #2
    Join Date
    Dec 2012
    Posts
    1
    Go through some documents regarding encryption, there you will find advanced keys,and algorithms.

Similar Threads

  1. How I can Encrypt any text
    By anonymous in forum VB Classic
    Replies: 0
    Last Post: 06-30-2002, 01:10 AM
  2. Text encrypt
    By MPT in forum VB Classic
    Replies: 0
    Last Post: 04-18-2002, 04:06 PM
  3. How encrypt a text?
    By Mr Joe in forum VB Classic
    Replies: 1
    Last Post: 03-26-2002, 04:32 PM
  4. How to compress and encrypt files in VB6
    By FM in forum VB Classic
    Replies: 5
    Last Post: 04-26-2001, 12:37 PM
  5. How to compress and encrypt files in VB6
    By FM in forum VB Classic
    Replies: 1
    Last Post: 04-14-2001, 10:18 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center