Advertisement
CoMoDoS

citeste cuvant tast/afiseaza cuv fisier

Nov 22nd, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. .386
  2. .model flat, stdcall
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4.  
  5. ;includem msvcrt.lib, si declaram ce functii vrem sa importam
  6. includelib msvcrt.lib
  7. extern printf: proc
  8. extern exit: proc
  9. extern scanf: proc
  10. extern fopen: proc
  11. extern fprintf: proc
  12. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  13.  
  14. ;declaram simbolul start ca public - de acolo incepe executia
  15. public start
  16. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17.  
  18. ;sectiunile programului, date, respectiv cod
  19. .data
  20.  
  21. msg db "Introduceti sirul de caractere!",0
  22. string db 100 dup(0),0 ; !!!!!!!!
  23. format db "%s", 0
  24. format1 db "Stringul este %s",0
  25. mode_write DB "w", 0
  26. file_name DB "fisier.txt", 0
  27. .code
  28. start:
  29. ;mov ecx,0
  30. push offset msg
  31. call printf
  32. ;add esp,4
  33. push offset string
  34. push offset format
  35. call scanf
  36. ;add esp,8
  37.  
  38. ;mov esi,0
  39. push offset string
  40. push offset format1
  41. call printf
  42. ;add esp,12
  43.  
  44.  
  45. push offset mode_write
  46. push offset file_name
  47. call fopen
  48. push EAX ;in eax a fost returnat pointer-ul spre fisier
  49.  
  50.  
  51.  
  52. push offset string
  53. push offset format1
  54. push eax
  55. call fprintf
  56. ; citeste de la tastatura un cuvant si il afiseaza in fisier
  57. push 0
  58. call exit
  59. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement