WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('in-progress') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

WordPress database error: [Table './ay6u3nor6dat6ba1/kn6_ayu1n9k4_5_actionscheduler_actions' is marked as crashed and last (automatic?) repair failed]
SELECT a.action_id FROM kn6_ayu1n9k4_5_actionscheduler_actions a WHERE 1=1 AND a.hook='aioseo_send_usage_data' AND a.status IN ('pending') ORDER BY a.scheduled_date_gmt ASC LIMIT 0, 1

File Copying in C | Loop and Break

File Copying in C

We have already used the function fgetc( ) which reads characters from a file. Its counterpart is a function called fputc( ) which writes characters to a file. As a practical use of these character I/O functions we can copy the contents of one file into another, as demonstrated in the following program. This program takes the contents of a file and copies them into another file, character by character.

#include <stdio.h>
int main()
{
	FILE *fs, *ft;
	char ch;
	fs = fopen("sourcefile.txt", "r");
	if (fs == NULL)
	{
		puts("Cannot open source file");
		exit(0);
	}
	ft = fopen("targetfile.txt", "w");
	if (ft == NULL)
	{
		puts("Cannot open target file");
		fclose(fs);
		exit(0);
	}
	while (1)
	{
		ch = fgetc(fs);
		if (ch == EOF)
			break;
		else
			fputc(ch, ft);
	}
	fclose(fs);
	fclose(ft);
	getchar();
	return 0;
}
Share

You may also like...