Assertion Error: Expression:(stream !=NULL)

Hi,

I've been working on a code for a text processor and after creating this bit of code it started to tell me of a stack overflow. I reduced the array size from 1000000 to 1000, but now it has the assertion error within it and I dont know how to fix it. Any adivce would be apprecited!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <fstream>
#include <iostream>
#include <conio.h>
#include <iomanip>

void writefile()
{
	char writefile[1000];
	
	char openfile [20];

	FILE * pFile;

	cout<<"\nFile name to open: ";
	cin>>openfile;

	pFile = fopen (openfile ,"w");

if (pFile == NULL) perror ("Error opening file");
		 else {
	cout<<"Enter text:"<<endl;
	cin>>writefile;

	fputs(writefile, pFile);
	fclose (pFile);
}
}
Topic archived. No new replies allowed.