All pastes #799486 Raw Edit

Something

public text v1 · immutable
#799486 ·published 2007-11-27 18:03 UTC
rendered paste body
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct Poleis {
	char kp[6];
	char po[20];
	int pl;
	char no[20];
};

struct IPoleis{
	char kp[6];
	int dief;
};



main() {
	FILE *k;
	char ob[20]="Poleis.ndx";
	
	struct IPoleis bki;
	int pl, i=0; 

	k=fopen(ob, "rb");
	fseek(k, 0, SEEK_END);
	pl=ftell(k) / sizeof(struct IPoleis);
	fseek(k, 0, SEEK_SET);
	
	printf("\nArxeio euretirio: \n");
	for (i=0; i<pl; i++) {
		fread(&bki, sizeof(struct IPoleis), 1, k);
		printf("%s == %d\n", bki.kp, bki.dief);
	}
	fclose(k);
}