From 64fb4d9c0b3417183792d8b02f0017ddfda782c1 Mon Sep 17 00:00:00 2001 From: pourchot Date: Thu, 30 Mar 2023 11:18:50 +0200 Subject: [PATCH] 30 Mars --- SCR1.2/TP11/get_numb.c | 37 +++++++++++++++++++++++++++++++++++++ SCR1.2/TP11/put_numb.c | 16 ++++++++++++++++ SCR1.2/TP11/resultat.txt | Bin 32 -> 372 bytes SCR1.2/TP11/store_numb.c | 2 +- SCR1.2/TP14/ft-file.dat | Bin 0 -> 9216 bytes SCR1.2/TP15/reponses.txt | 0 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 SCR1.2/TP11/get_numb.c create mode 100644 SCR1.2/TP11/put_numb.c create mode 100644 SCR1.2/TP14/ft-file.dat create mode 100644 SCR1.2/TP15/reponses.txt diff --git a/SCR1.2/TP11/get_numb.c b/SCR1.2/TP11/get_numb.c new file mode 100644 index 0000000..c934ac4 --- /dev/null +++ b/SCR1.2/TP11/get_numb.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +#define SZBUF 256 + +int main(int argc, char const *argv[]){ + int fd,n,l,x; + long int i, offset; + if (argc<3){ + fprintf(stderr,"Usage : %s \r",argv[0]); + exit (1); + } fd=open (argv[1], O_RDONLY); + if (fd==-1){ + perror("Opening destination file fails"); + exit (2); + } i=strtol(argv[2],NULL,0); + offset=i*(sizeof(int)); + l=lseek(fd,offset,SEEK_SET); + if(l==1){ + perror("lsink failed"); + close(fd); + exit (3); + } + n=read(fd,&x,sizeof(int)); + if(n==-1){ + perror("Read in file failed"); + close(fd); + exit (4); + } if(n==0){ + printf("Out of range\n"); + } else{ + printf("The number at offset %ld is 0x%08x --> %d \n",i,x,x); + } close(fd); + exit(0); +} \ No newline at end of file diff --git a/SCR1.2/TP11/put_numb.c b/SCR1.2/TP11/put_numb.c new file mode 100644 index 0000000..7b7c0a4 --- /dev/null +++ b/SCR1.2/TP11/put_numb.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include + +#define SZBUF 256 + +int main(int argc, char const *argv[]){ + char buf[SZBUF]; + int fd,n,m; + if (argc<4){ + fprintf(stderr,"Usage : %s <32-bit int in Hex> \r",argv[0]); + exit (1); + } +} \ No newline at end of file diff --git a/SCR1.2/TP11/resultat.txt b/SCR1.2/TP11/resultat.txt index 6563d8550ecc0ad0a6eb677610845294bbf45f8b..9d6a7c6f34cc69d47fb954b484370fa3cdd5549c 100644 GIT binary patch literal 372 zcmYL_y$%6U5Jty8AyFt~V`#y?TKw?2_6KYrl82-_loyoT*w* zFmC`|a5rZ@QbzVV6HE16?!LC;IB?c? \r",argv[0]); + fprintf(stderr,"Usage : %s \n",argv[0]); exit (1); } fd=open (argv[1], O_WRONLY|O_TRUNC|O_CREAT,0b00); if (fd==-1){ diff --git a/SCR1.2/TP14/ft-file.dat b/SCR1.2/TP14/ft-file.dat new file mode 100644 index 0000000000000000000000000000000000000000..9b61edb275d8c1a4c7066d538ae9cbd146fe3be5 GIT binary patch literal 9216 zcmV+bB>&rjVE~3r-Ju4ssekI(Hjpv@@eMWhAxjw}Sxen>Q8i0{W%DbDz&KPkgK|JH zh8Eaq0r}eV=MvrFss7?hb<|A6ixgeHjA)xIWN#%unye}~uNINh@%_I~-Cs>MpZT(r37~utnw zLiEKfeXbOI8#YL;$u0rW!p&Hk6ER~9KRRN8KLzYZfMUl0q2%q;&~!g>x%(NHM8bz|u?{8+HoS?*NAOteZzM4yo2C&iK5~(qlKeoH#DVS4!=!4q zXJf*X)xER%a_ykpg@wzDehZBaJI$Y_9EG;}M=k5Iv zdFdJ`K1j!_0ZE<{MtmI&fs#=r-Qdk%<1|ZzcBpi%JUYkllXCNB(vsO%$9A6BB5FLM zd>J^yKQRKV2}m8eAZ1mDMu11E2RCAL#kJgKrQBY64TazQ3&jgQRb2xPOjg+3f2T2KTFTWT zuRcs0^Ed$(fo>}CJX6`OK(jm+ezl&SRJdPmt^9D)KVCoWlzCsx{=%&q?z72cedh3A!LBIm73njC0f)o{u7xP5Mc4$FT-+K?pjJbGozqo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