Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <fcntl.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6.  
  7. #define f_nev"./text.txt"
  8. int fgv1(void);
  9. int main()
  10. { int f1vissza=0;
  11. f1vissza=fgv1();
  12. //printf("%i\n",f1vissza);
  13. return 0;}
  14. int fgv1(void)
  15. {
  16. int i,a,b=0,c=0,db=0,y=0,file=0;
  17. file=open(f_nev,O_CREAT|O_TRUNC|O_RDWR,S_IWRITE|S_IREAD);
  18. for(i=0,a=22;i<5;a++)
  19. { if(((a&0b1101)==(0b1101))&&(a%2!=0))
  20. {
  21. write(file,&a,sizeof(int));
  22. db++;
  23. i++;}
  24.  
  25. }
  26. lseek(file,0,SEEK_SET);
  27. read(file,&y,sizeof(int));
  28. close(file);
  29. printf("%i\n",db);
  30. printf("%i",y);
  31. return file;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement