Skip to content

Instantly share code, notes, and snippets.

@valerionew
Created April 8, 2018 13:26
Show Gist options
  • Save valerionew/9db7d4c27f06e6da95c2f201902f24d7 to your computer and use it in GitHub Desktop.
Save valerionew/9db7d4c27f06e6da95c2f201902f24d7 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char const *argv[]) {
FILE * lettura = fopen("campionetesto.txt", "r");
if ( lettura == NULL )
return -1;
FILE * scrittura = fopen("campione.txt", "wb");
if ( scrittura == NULL )
return -1;
uint16_t number = 0;
do{
fscanf(lettura,"%d", &number);
fwrite(&number, 1, 2, scrittura);
}while (!feof(lettura));
fclose(lettura);
fclose(scrittura);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment