Hey,

How do I create a file from a C program? I want to check if the file exists and if it doesnt, then create it. I am using the following code to check if it exists:

filecheck()
{
	b=fopen("password.csv","r+w");
	if(b==NULL)
	{

         // need code for creating a file
       }
}
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.