I'm having issues with this code I'm doing and I was wondering how I should fix the error I'm getting back after trying to run it. The code is meant to encode and decode text files using c strings.
void mapitE(string,char[]);
void mapitD(string,char[]);
void encryptdecrypt(const string,const char[],int,string&);
int main()
{
string ende[]={"encrypt","decrypt"},buffer,key,newbuffer="";
char filename[80],enmap[128],demap[128],again;
int i,maplength;
ofstream out;
ifstream in;
int choice;
do
{
cout<>choice;
while(choice2)
{
cout<<"invalid choice\n";
cout<>choice;
}
cout<<"Enter name of your file to "<<ende[choice-1]<>filename;
in.open(filename);
if(in.fail())
{
cout<<"input file did not open please check it\n";
system("pause");
return 1;
}
cout<>filename;
out.open(filename);
cout<>key;
if(key.length()>128)
{
cout<<"key too long\n";
cout<>key;
}
The issue with this is when I try to compile it I get this back in the output box.
1>------ Build started: Project: ConsoleApplication8, Configuration: Debug Win32 ------
1> Source.cpp
1>\\acad.dvuadmin.net\sce\homedir\d40048587\documents\visual studio 2012\projects\consoleapplication8\consoleapplication8\source.cpp(4): fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm using visual studios 2010 for this code and would appreciate any help I can get, as I am sure this one little error is the only thing keeping my code from running perfectly.
The answer to your problem, is actually an easy one. #include <stdafx.h> MUST be the first include, so put it at the top of your code. The program should run afterwards, with no problems.