#include<stdio.h>
#define FILENAME1 "all.txt"
#define FILENAME2 "even.txt"
#define FILENAME3 "odd.txt"
int main()
{
	int i=0;
	
	FILE *all;
	all = fopen(FILENAME1, "r");
	while(fscanf(all,"%d")!=EOF)
	{	printf("\n%d",i);
	    i++;
	}

	FILE *even;
	even = fopen(FILENAME2, "w");

	FILE *odd;
	odd = fopen(FILENAME3, "w");

	for(i=0;i<=10;i++)
	{
		if(i%2==1)
		fprintf(odd,"%d",i);
		

		else
		fprintf(even, "%d",i);
		
	}
	
	return 0;
}

fscanf() was missing one argument.

int main()
{
	int i=0;
	[B]int d=0;[/B]
	FILE *all;
	all = fopen(FILENAME1, "r");
	while(fscanf(all,"%d", [B]&d[/B])!=EOF)
        ...
}
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.