Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
void BinTiedostonKirjoitus()
{ 
  FILE*fp;
  char juttu\[100\];
  strcpy(juttu,"tämä on testi"); //tiedoston avaus
  if((fp=fopen("C:testi.bin","wb")) == NULL) 
  { 
    printf(" tiedostoa ei voi avata ");
    return;
  }
  fwrite(juttu,sizeof(char),len(juttu),fp);
  fclose(fp);
  printf("talletin PAINA ENTER");
  }

void BinTiedostonLuku()
{ 
  FILE \*fp;
  char juttu\[100\];
  if((fp=fopen("a:testi.bin","rb")) == NULL) return;
  if(fread(juttu,sizeof(char),100,fp)!=1)
  {
  {  fclose(fp);
    return;
  }
printf("\n Binääritiedoston lukuvirhe ");

}

...