🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #65

Re: TRe: Structure et tableau en C ?

#65
From: Thierry59
Date: Sun, 06 Feb 2005 23:58
96 lines
3454 bytes
Merci beaucoup pour votre reponse..  Ca fonctionne. je vais pouvoir
continuer mon projet... Encore Merci

ps: defois, savez vous comment acceder au disque dur ? au boot secteur par
example?
Merci.

thierry

"Horst Kraemer" <h-kraemer@lycos.de> a �crit dans le message de
news:5jnc01d8fgjc3gljjuf4rhs54h2l16i212@4ax.com...
> "Thierry59" <thierry59__no_spam@tiscali.fr> wrote:
>
> > Merci pour vos reponses, mais je n'ai pas su me depatoullier.... je met
un
> > exemple....
> >
> > // Note 1: la structure definissant une partie de la structure de la
FAT....
> > (boot secteur....) :  Declaration global
> >  struct FatBootsector
> > {
> >      unsigned char jump[3];
> >      unsigned char oem_id[8];
> >      unsigned short bytes_per_sector;
> >      unsigned char sectors_per_cluster;
> >      unsigned short num_boot_sectors;
> >     ......... etc .........
> > };                              /* 512 bytes total */
>
> V�rifier que
>
> sizeof (struct FatBootsector) == 512
>
>
>
>
> > // Note 2: Fonction qui permet de visualiser les infos du boot secteur
d'un
> > disque FAT16 par exemple:
>
> void ShowTable(struct FatBootsector *MBR)
> {
>
>      printf("Oem %.8s\n",MBR->oem_id);
>
> }
>
> >
> > // Note 3: Programme principal par Ex....
> > main()
> > {
> > unsigned char  Tab[512];
> >
> >         ReadFat(2,Tab)          // je recup le boot secteur.....
> >         ShowTable(Tab);       // affichage des indos....
>
> remplacer par
>
> struct FatBootsector Fat;
>
> if (sizeof Fat != 512)
>         {
>            fprintf(stderr,"sorry, sizeof Fat is %d\n",
>                           (int)sizeof Fat);
>            exit(EXIT_FAILURE);
>         }
>
> ReadFat(2,(unsigned char*)&Fat)
> ShowTable(&Fat);
>
>
> > }
>
> Une m�thode �quivalente serait
>
> unsigned char  Tab[512];
>
> if (sizeof (struct FatBootsector) != 512)
>         {
>            fprintf(stderr,
>                   "sorry, sizeof(struct FatBootsector) is %d\n",
>                   (int)sizeof (struct FatBootsector));
>            exit(EXIT_FAILURE);
>         }
>
>         ReadFat(2,Tab)
>         ShowTable((struct FatBootsector*)Tab);
>
> toujours avec la d�claration
>
> ShowTable(struct FatBootsector *MBR)
>
> -- 
> Horst
>
Technical Details
Message-ID: <cu6b6a$i64$1@news.tiscali.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tiscali.fr!not-for-mail
References: <ctu7go$9cu$1@news.tiscali.fr> <mn.2ab77d52fdfd0d34.15512@YOURBRAnoos.fr> <cu5k8g$jal$1@news.tiscali.fr> <5jnc01d8fgjc3gljjuf4rhs54h2l16i212@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,807078fb0437ad92
X-Google-Thread: 102e15,9f3075a9014ccc0b
X-Google-Attributes: gidf9822,gid102e15,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tiscali.fr!not-for-mail
From: "Thierry59" <thierry59__no_spam@tiscali.fr>
Newsgroups: fr.comp.lang.c,fr.comp.developpement
Subject: Re: TRe: Structure et tableau en C ?
Date: Mon, 7 Feb 2005 00:58:38 +0100
Organization: Guest of TISCALI - FRANCE
Lines: 98
Message-ID: <cu6b6a$i64$1@news.tiscali.fr>
References: <ctu7go$9cu$1@news.tiscali.fr> <mn.2ab77d52fdfd0d34.15512@YOURBRAnoos.fr> <cu5k8g$jal$1@news.tiscali.fr> <5jnc01d8fgjc3gljjuf4rhs54h2l16i212@4ax.com>
Reply-To: "Thierry59" <thierry59__no_spam@tiscali.fr>
NNTP-Posting-Host: dyn-213-36-2-142.ppp.tiscali.fr
X-Trace: news.tiscali.fr 1107734546 18628 213.36.2.142 (7 Feb 2005 00:02:26 GMT)
X-Complaints-To: abuse@libertysurf.fr
NNTP-Posting-Date: Mon, 7 Feb 2005 00:02:26 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441