[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Skum struct.



Hejsan !

Har enstruct här som bör bli 360 bytes stor. Tyvärr, så påstår min maskin att
den är 364bytes stor. Har suttit och funderat länge och väl, men kommer inte på
varför.

Undrar om någon kan hjälpa mig med detta :-/


#include <stdio.h>
#include <string.h>

#define uchar unsigned char
#define ushort unsigned short

typedef struct {        /* Callsign structure used in info  */

  char callsign[7]   ;
  char ssid          ;

} indicat            ;

typedef struct {

  indicat  indic     ;  /* 8   Callsign                     */
  indicat  relai[8]  ;  /* 64  Digis path                   */
  int     lastmes   ;  /* 4   Last L number                */
  int     nbcon     ;  /* 4   Number of connexions         */
  int     hcon      ;  /* 4   Last connexion date          */
  int     lastyap   ;  /* 4   Last YN date                 */
  ushort flags     ;  /* 2   Flags                        */
  ushort on_base   ;  /* 2   ON Base number               */
  uchar    nbl       ;  /* 1   Lines paging                 */
  uchar    lang      ;  /* 1   Language                     */
  int     newbanner ;  /* 4   Date of new banner (lang.NEW)*/
  ushort   download  ;  /* 2   Download size in KB          */
  char     free[20]  ;  /* 20  Reserved                     */
  char     thema     ;  /* 1   Current thema selection      */
  char     nom[18]   ;  /* 18  1st Name                     */
  char     prenom[13];  /* 13  Christian name               */
  char     adres[61] ;  /* 61  Address                      */
  char     ville[31] ;  /* 31  City                         */
  char     teld[13]  ;  /* 13  home phone                   */
  char     telp[13]  ;  /* 13  job phone                    */
  char     home[41]  ;  /* 41  home BBS                     */
  char     qra[7]    ;  /* 7   Qth Locator                  */
  char     priv[13]  ;  /* 13  PRIV directory               */
  char     filtre[7] ;  /* 7   LC choice filter             */
  char     pass[13]  ;  /* 13  Password                     */
  char     zip[9]    ;  /* 9   Zipcode                      */

} info               ;  /* 360 bytes = lenght of one record */



int main(void)
{
  FILE *infile, *outfile;
  char buffer[20];
  info Info;

  infile=fopen("inf.sys","rb");
  outfile=fopen("fixed_inf.sys","wb");

  printf("Structsize = %d\n",sizeof(Info));

  // Checking if inf.sys exists.
  if(!infile)
    {
      printf("Error: inf.sys not found.\n");
      exit(1);
    }

  // Creating output file for fixed database.
  if(!outfile)
    {
      printf("Error: Could not create fixed_inf.sys for writing.\n");
      exit(1);
    }


  while(!feof(infile))
    {
      fread(&Info,sizeof(Info),1,infile);
      
      strcmp(buffer,Info.indic.callsign);
      //      printf("%s\n",Info.indic.callsign);
      if(strstr(buffer,"SK7z"))
	{
	  printf("%s\n",Info.indic.callsign);
	  printf("SK7z found\n");
	  continue;
	}

      fwrite(&Info,sizeof(Info),1,outfile);
    }

  printf("Database fixed. Thanks for using this program !\n");
  
  return(0);
}
      





 --

/Jocke

ICQ uin: 3939304

----------------------------------------------------------------

***     Linux..... The choice of a thinking generation     *****

----------------------------------------------------------------



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *