products/Sources/formale Sprachen/COBOL/Test-Suite/SQL M image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: xts766.cob   Sprache: Unknown

//$ fdisk -cul /dev/sdb
//Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
//255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
//Units = sectors of 1 * 512 = 512 bytes
//Sector size (logical/physical): 512 bytes / 512 bytes
//I/O size (minimum/optimal): 512 bytes / 512 bytes
//Disk identifier: 0x790b1f29
//
//   Device Boot      Start         End      Blocks   Id  System
// /dev/sdb1              63  1953520064   976760001   fd  Linux raid autodetect
//
// $ gcc --std=c99 -o ndi ndi.c
// $ ./ndi /dev/sdb
// $ fdisk -cul /dev/sdb
// Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
// 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
// Units = sectors of 1 * 512 = 512 bytes
// Sector size (logical/physical): 512 bytes / 512 bytes
// I/O size (minimum/optimal): 512 bytes / 512 bytes
// Disk identifier: 0xdeadbeef
// 
//   Device Boot      Start         End      Blocks   Id  System
// /dev/sdb1              63  1953520064   976760001   fd  Linux raid autodetect

#include <stdio.h>
#define NEW_DISK_IDENT 0xDEADBEEF
#define IDENT_POSITION 0x1B8
#define IDENT_LENGTH 4 

void readDiskIdentifier(FILE* fp)
  {
  fseek(fp, IDENT_LENGTH - 1 + IDENT_POSITION, SEEK_SET);
  for(int i = 0; i < IDENT_LENGTH; i++)
  {
  printf("%0*X", 2, fgetc(fp));
    fseek(fp, -2, SEEK_CUR);
    }
    printf("\n");
}

void writeDiskIdentifier(FILE* fp)
  {
  fseek(fp, IDENT_POSITION, SEEK_SET);
  for(int i = 0; i < IDENT_LENGTH; i++)
  fputc(0xFF & (NEW_DISK_IDENT >> i*8), fp);
  }
  
  int main(int argc, char **argv)
  {
  if (argc > 1)
  {
  printf("%s\n", argv[1]);
    FILE* fp = fopen(argv[1], "r+");
    printf("Current disk identifier: ");
    readDiskIdentifier(fp);
    writeDiskIdentifier(fp);
    printf("New disk identifier: ");
    readDiskIdentifier(fp);
    fclose(fp);
    return 0;
    } else
  printf(" usage: %s file\n Example: %s /dev/sdb\n", argv[0],
  argv[0]);
  return -2;
  
}

[ Verzeichnis aufwärts0.17unsichere Verbindung  Übersetzung europäischer Sprachen durch Browser  ]