Here is my code so far, the problem is when I debug it I keep getting the same error but everything seems to be correct.
The error is:
Unhandled exception at 0x00ED8F34 in ENCDEC.exe: 0xC0000005: Access violation reading location 0x00000008.

#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>

using namespace std;
char buffer[100];

class cSecret{
public:
cSecret();
~cSecret();
void choice();
void encrypt();
void decrypt();
void open();
void save();
void key();

private:
ifstream infile;
ifstream infile1;
ofstream outfile;
ofstream outfile2;
int key1;
string input;
int lengthable;
int choice1;
int x,i;
};

cSecret::cSecret()
{
int key1 = 0;
int lengthable = 0;
int choice1 = 0;
int x = 0;

}

cSecret::~cSecret()
{
}


void cSecret::choice()
{
printf("Press 1 for ROT13 encryption of 2 for XOR: \n");
cin >> choice1;

if(choice1==1)
{
printf( "ROT13 encryption\n");

} else if (choice1==2)
{
printf("XOR encryption\n");

}
}

void cSecret::encrypt()
{
lengthable = sprintf(buffer, "%s", buffer);
if (choice1==1){
for(x=0; x < lengthable;x++){
if (buffer[x] > 'A' && buffer[x] < 'N' || buffer[x] > 'a' && buffer[x] < 'n') {
buffer[x] += 13;
} else if (buffer[x] > 'M' && buffer[x] < 'Z' || buffer[x] > 'm' && buffer[x] < 'z') {
buffer[x] -= 13;
}
}
} else
if (choice1==2){
printf("Enter encryption key: ");
cin >> key1;
for(x=0; x < lengthable;x++){
buffer[x] ^= key1;
}
}
}

void cSecret::decrypt()
{
printf("Press 1 for ROT13 or 2 for XOR decryption\n");
cin >> choice1;
lengthable = sprintf(buffer,"%s", buffer);
if (choice1==1){
for(x=0; x < lengthable;x++){
if (buffer[x] > 'A' && buffer[x] < 'N' || buffer[x] > 'a' && buffer[x] < 'n') {
buffer[x] += 13;
} else if (buffer[x] > 'M' && buffer[x] < 'Z' || buffer[x] > 'm' && buffer[x] < 'z') {
buffer[x] -= 13;
}
}
} else
if (choice1==2){
for(x=0; x < lengthable;x++){
buffer[x] ^= key1;
}
}
}

void main(char* argc[],int argv)
{
cSecret robot;
FILE *pfile;
pfile = fopen(argc[1],"r");
fread(buffer, 1, 10000, pfile);
int i;
robot.choice();
robot.encrypt();
FILE *sfile;
sfile = fopen(argc[2], "w");
fputs(buffer, sfile);
robot.decrypt();
FILE *sfile2;
sfile2 = fopen(argc[3], "w");
fputs(buffer, sfile2);

}