I need to write a program in C that decrypts a 12 character message in the file encrypted.txt however whenever I try to open this file it comes up as null. I'm confused, I've tried different methods, the only thing I can think of is I don't have the file, so I believe I need to create it in stdio.h, however I can't find where that is located either.

If someone could shed some light on my problem, I would appreciate it.

Thank you.

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

int main()
{
	FILE *fp;

	if ((fp = fopen("encrypted.txt", "r")) ==NULL) 
	{
		printf("Input file could not be opened\n");
		exit(1);
	}
	return 0;
}

Is encrypted.txt in the same folder your program is in? Also, what operating system are you running?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.