diff --git a/laba.c b/laba.c new file mode 100644 index 0000000..5235359 --- /dev/null +++ b/laba.c @@ -0,0 +1,27 @@ +#include +#include + +struct paket { + int a;  + char c[255];  + float b; +}; +int main(int argc, char *argv[]) {    + struct paket d;    + int x;    + FILE *fp=NULL; + if (argc>=2)    + fp = fopen(argv[1], "rb");    + if (fp == NULL){       + printf("the file was unable to access\n");        + printf("enter: %s \n", argv[0]);       + return 1;   + }    + while (fread(&d, sizeof(struct paket), 1, fp)) {      + printf("%d %s %f\n", d.a, d.c, d.b);        + x++;   + }    + printf("Size of file = %d bytes\n", x*sizeof(d));  + fclose(fp);    + return 0; +}