Problème avec fseek C

VEF_King -  
 VEF_King -
Bonjour,

Tout d'abord, bon dimanche à tous.
Voilà, je fais quelques exercices en C et j'ai un petit soucis avec la fonction fseek.

Je n'arrive pas à afficher le client que je veux et je ne comprends pas pourquoi...

Voici mon code:

#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>

struct s_client
{
	char nom[41];
	char pre[41];
	short age;
	char ville[41];
};

int main()
{
	FILE *fich;
	struct s_client cli;

	fich=fopen("c:\\stockage\\clients.dat","rb");

	if (fich == NULL)
	{
		printf("ERREUR ==> impossible d'ouvrir le fichier\n\n");
	}
	else
	{
		fseek(fich, (sizeof(struct s_client)*3),0); // Mon but est d'afficher le nom et le prénom du troisième client
		printf ("%s\n%s\n", cli.nom, cli.pre);

		fclose(fich);
	}

	return 0;
}



Merci d'avance...

Nico



1 réponse

VEF_King
 
Au temps pour moi. J'ai oublié le fread ();
0