elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


  Mostrar Temas
Páginas: [1]
1  Programación / Java / Arreglo de inmuebles en: 18 Febrero 2015, 21:30 pm
Hola, estoy haciendo un programa pero tengo un error en la implementación de mi código y no se cual es, lo que pasa es que escogiendo la opción 2(Mostrar Inmuebles), sale para cada inmueble el mismo propietario.

Estas son las Clases

Código
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5.  
  6. public class TestPropietario {
  7.  
  8. private static Inmueble ArregloI[]=new Inmueble[5];
  9.  
  10. public static void Imprimir(int Pos) throws IOException{
  11. System.out.println("\nPropietario " + ArregloI[Pos].getMiPropietario().getNombreCompleto() + ":\n");
  12. System.out.println("Estado " + ArregloI[Pos].getEstado() + "\n");
  13. }
  14.  
  15. public static int MenuPrincipal() throws IOException{
  16. int Opcion=0;
  17. String Capturar;
  18.  
  19. System.out.println("\n1. Ingresar un inmueble\n");
  20. System.out.println("2. Mostrar Inmuebles\n");
  21. System.out.println("3. Salir\n");
  22.  
  23. Capturar= Lector.readLine();
  24. Opcion=Integer.parseInt(Capturar);
  25. return Opcion;
  26. }
  27.  
  28.  
  29. public static void main(String[] args) throws IOException{
  30.  
  31. int OpcionM=0, Cont=0;
  32. Propietario AuxProp= new Propietario(null, null);
  33. String Estado = null;
  34.  
  35. String Capturar;
  36.  
  37. for(int i=0; i<5; i++)
  38. ArregloI[i]= new Inmueble();
  39.  
  40. while(OpcionM!=3){
  41.  
  42. OpcionM=MenuPrincipal();
  43.  
  44. switch(OpcionM){
  45. case 1:
  46. System.out.println("Ingrese el Estado del Inmueble (Libre - Ocupado)");
  47. Capturar= Lector.readLine();
  48. Estado=Capturar;
  49.  
  50. System.out.println("Ingrese el Nombre del Propietario");
  51. Capturar= Lector.readLine();
  52. AuxProp.setNombreCompleto(Capturar);
  53.  
  54. System.out.println("Ingrese el numero de telefono del propietario");
  55. Capturar= Lector.readLine();
  56. AuxProp.setTelContac(Capturar);
  57.  
  58. if(Cont<5){
  59. ArregloI[Cont].Llenar(Estado, AuxProp);
  60. Cont+=1;
  61. }
  62. else
  63. System.out.println("Ha llegado al límite máximo de Inmuebles");
  64. break;
  65. case 2:
  66. for(int i=0; i<5; i++)
  67. Imprimir(i);
  68. break;
  69. case 3:
  70. break;
  71. }
  72. }
  73.  
  74.  
  75. }
  76.  



Código
  1.  
  2. public class Propietario {
  3. private String NombreCompleto;
  4. private String TelContac;
  5.  
  6.  
  7. public Propietario(String nombreCompleto, String telContac) {
  8. NombreCompleto = nombreCompleto;
  9. TelContac = telContac;
  10. }
  11.  
  12.  
  13. public String getNombreCompleto() {
  14. return NombreCompleto;
  15. }
  16.  
  17.  
  18. public void setNombreCompleto(String nombreCompleto) {
  19. NombreCompleto = nombreCompleto;
  20. }
  21.  
  22.  
  23. public String getTelContac() {
  24. return TelContac;
  25. }
  26.  
  27.  
  28. public void setTelContac(String telContac) {
  29. TelContac = telContac;
  30. }
  31.  
  32. }
  33.  



Código
  1.  
  2. public class Inmueble {
  3. private String Estado;
  4. private Propietario MiPropietario=new Propietario(null, null);
  5.  
  6.  
  7. public void Llenar(String Estado, Propietario MiPropietario){
  8. setEstado(Estado);
  9. setMiPropietario(MiPropietario);
  10. }
  11.  
  12. public Inmueble() {
  13. }
  14.  
  15. public String getEstado() {
  16. return Estado;
  17. }
  18. public void setEstado(String estado) {
  19. Estado = estado;
  20. }
  21. public Propietario getMiPropietario() {
  22. return MiPropietario;
  23. }
  24. public void setMiPropietario(Propietario miPropietario) {
  25. MiPropietario = miPropietario;
  26. }
  27. }
  28.  

Verán, al momento ingresar a la opción 2 después de haber llenado 2 inmueble sale algo así:

2  Programación / Ingeniería Inversa / Desensamblado de un archivo binario en: 26 Noviembre 2014, 03:00 am
Hola gente, gracias por leer mi post, primero que todo tengo un archivo desensamblado en codigo ensamblador y quisiera que me guiaran por donde empiezo para interpretar y lograr descifrar que es lo que hace el programa

Código:

08048424 <_init>:
 8048424: 53                    push   %ebx
 8048425: 83 ec 08              sub     $0x8,%esp
 8048428: e8 13 01 00 00        call     8048540 <__x86.get_pc_thunk.bx>
 804842d: 81 c3 d3 1b 00 00    add     $0x1bd3,%ebx
 8048433: 8b 83 fc ff ff ff    mov    -0x4(%ebx),%eax
 8048439: 85 c0                test     %eax,%eax
 804843b: 74 05                je       8048442 <_init+0x1e>
 804843d: e8 6e 00 00 00        call    80484b0 <__gmon_start__@plt>
 8048442: 83 c4 08              add    $0x8,%esp
 8048445: 5b                    pop    %ebx
 8048446: c3                    ret   

Desensamblado de la sección .plt:

08048450 <read@plt-0x10>:
 8048450: ff 35 04 a0 04 08    pushl  0x804a004
 8048456: ff 25 08 a0 04 08    jmp    *0x804a008
 804845c: 00 00                add    %al,(%eax)
...

08048460 <read@plt>:
 8048460: ff 25 0c a0 04 08    jmp    *0x804a00c
 8048466: 68 00 00 00 00        push   $0x0
 804846b: e9 e0 ff ff ff        jmp    8048450 <_init+0x2c>

08048470 <printf@plt>:
 8048470: ff 25 10 a0 04 08    jmp    *0x804a010
 8048476: 68 08 00 00 00        push   $0x8
 804847b: e9 d0 ff ff ff        jmp    8048450 <_init+0x2c>

08048480 <inet_pton@plt>:
 8048480: ff 25 14 a0 04 08    jmp    *0x804a014
 8048486: 68 10 00 00 00        push   $0x10
 804848b: e9 c0 ff ff ff        jmp    8048450 <_init+0x2c>

08048490 <htons@plt>:
 8048490: ff 25 18 a0 04 08    jmp    *0x804a018
 8048496: 68 18 00 00 00        push   $0x18
 804849b: e9 b0 ff ff ff        jmp    8048450 <_init+0x2c>

080484a0 <puts@plt>:
 80484a0: ff 25 1c a0 04 08    jmp    *0x804a01c
 80484a6: 68 20 00 00 00        push   $0x20
 80484ab: e9 a0 ff ff ff        jmp    8048450 <_init+0x2c>

080484b0 <__gmon_start__@plt>:
 80484b0: ff 25 20 a0 04 08    jmp    *0x804a020
 80484b6: 68 28 00 00 00        push   $0x28
 80484bb: e9 90 ff ff ff        jmp    8048450 <_init+0x2c>

080484c0 <__libc_start_main@plt>:
 80484c0: ff 25 24 a0 04 08    jmp    *0x804a024
 80484c6: 68 30 00 00 00        push   $0x30
 80484cb: e9 80 ff ff ff        jmp    8048450 <_init+0x2c>

080484d0 <memset@plt>:
 80484d0: ff 25 28 a0 04 08    jmp    *0x804a028
 80484d6: 68 38 00 00 00        push   $0x38
 80484db: e9 70 ff ff ff        jmp    8048450 <_init+0x2c>

080484e0 <socket@plt>:
 80484e0: ff 25 2c a0 04 08    jmp    *0x804a02c
 80484e6: 68 40 00 00 00        push   $0x40
 80484eb: e9 60 ff ff ff        jmp    8048450 <_init+0x2c>

080484f0 <fputs@plt>:
 80484f0: ff 25 30 a0 04 08    jmp    *0x804a030
 80484f6: 68 48 00 00 00        push   $0x48
 80484fb: e9 50 ff ff ff        jmp    8048450 <_init+0x2c>

08048500 <connect@plt>:
 8048500: ff 25 34 a0 04 08    jmp    *0x804a034
 8048506: 68 50 00 00 00        push   $0x50
 804850b: e9 40 ff ff ff        jmp    8048450 <_init+0x2c>

Desensamblado de la sección .text:

08048510 <_start>:
 8048510: 31 ed                xor    %ebp,%ebp
 8048512: 5e                    pop    %esi
 8048513: 89 e1                mov    %esp,%ecx
 8048515: 83 e4 f0              and    $0xfffffff0,%esp
 8048518: 50                    push   %eax
 8048519: 54                    push   %esp
 804851a: 52                    push   %edx
 804851b: 68 60 88 04 08        push   $0x8048860
 8048520: 68 f0 87 04 08        push   $0x80487f0
 8048525: 51                    push   %ecx
 8048526: 56                    push   %esi
 8048527: 68 10 86 04 08        push   $0x8048610
 804852c: e8 8f ff ff ff        call   80484c0 <__libc_start_main@plt>
 8048531: f4                    hlt   
 8048532: 66 90                xchg   %ax,%ax
 8048534: 66 90                xchg   %ax,%ax
 8048536: 66 90                xchg   %ax,%ax
 8048538: 66 90                xchg   %ax,%ax
 804853a: 66 90                xchg   %ax,%ax
 804853c: 66 90                xchg   %ax,%ax
 804853e: 66 90                xchg   %ax,%ax

08048540 <__x86.get_pc_thunk.bx>:
 8048540: 8b 1c 24              mov    (%esp),%ebx
 8048543: c3                    ret   
 8048544: 66 90                xchg   %ax,%ax
 8048546: 66 90                xchg   %ax,%ax
 8048548: 66 90                xchg   %ax,%ax
 804854a: 66 90                xchg   %ax,%ax
 804854c: 66 90                xchg   %ax,%ax
 804854e: 66 90                xchg   %ax,%ax

08048550 <deregister_tm_clones>:
 8048550: b8 43 a0 04 08        mov    $0x804a043,%eax
 8048555: 2d 40 a0 04 08        sub    $0x804a040,%eax
 804855a: 83 f8 06              cmp    $0x6,%eax
 804855d: 77 01                ja     8048560 <deregister_tm_clones+0x10>
 804855f: c3                    ret   
 8048560: b8 00 00 00 00        mov    $0x0,%eax
 8048565: 85 c0                test   %eax,%eax
 8048567: 74 f6                je     804855f <deregister_tm_clones+0xf>
 8048569: 55                    push   %ebp
 804856a: 89 e5                mov    %esp,%ebp
 804856c: 83 ec 18              sub    $0x18,%esp
 804856f: c7 04 24 40 a0 04 08 movl   $0x804a040,(%esp)
 8048576: ff d0                call   *%eax
 8048578: c9                    leave 
 8048579: c3                    ret   
 804857a: 8d b6 00 00 00 00    lea    0x0(%esi),%esi

08048580 <register_tm_clones>:
 8048580: b8 40 a0 04 08        mov    $0x804a040,%eax
 8048585: 2d 40 a0 04 08        sub    $0x804a040,%eax
 804858a: c1 f8 02              sar    $0x2,%eax
 804858d: 89 c2                mov    %eax,%edx
 804858f: c1 ea 1f              shr    $0x1f,%edx
 8048592: 01 d0                add    %edx,%eax
 8048594: d1 f8                sar    %eax
 8048596: 75 01                jne    8048599 <register_tm_clones+0x19>
 8048598: c3                    ret   
 8048599: ba 00 00 00 00        mov    $0x0,%edx
 804859e: 85 d2                test   %edx,%edx
 80485a0: 74 f6                je     8048598 <register_tm_clones+0x18>
 80485a2: 55                    push   %ebp
 80485a3: 89 e5                mov    %esp,%ebp
 80485a5: 83 ec 18              sub    $0x18,%esp
 80485a8: 89 44 24 04          mov    %eax,0x4(%esp)
 80485ac: c7 04 24 40 a0 04 08 movl   $0x804a040,(%esp)
 80485b3: ff d2                call   *%edx
 80485b5: c9                    leave 
 80485b6: c3                    ret   
 80485b7: 89 f6                mov    %esi,%esi
 80485b9: 8d bc 27 00 00 00 00 lea    0x0(%edi,%eiz,1),%edi

080485c0 <__do_global_dtors_aux>:
 80485c0: 80 3d 44 a0 04 08 00 cmpb   $0x0,0x804a044
 80485c7: 75 13                jne    80485dc <__do_global_dtors_aux+0x1c>
 80485c9: 55                    push   %ebp
 80485ca: 89 e5                mov    %esp,%ebp
 80485cc: 83 ec 08              sub    $0x8,%esp
 80485cf: e8 7c ff ff ff        call   8048550 <deregister_tm_clones>
 80485d4: c6 05 44 a0 04 08 01 movb   $0x1,0x804a044
 80485db: c9                    leave 
 80485dc: f3 c3                repz ret
 80485de: 66 90                xchg   %ax,%ax

080485e0 <frame_dummy>:
 80485e0: a1 08 9f 04 08        mov    0x8049f08,%eax
 80485e5: 85 c0                test   %eax,%eax
 80485e7: 74 1f                je     8048608 <frame_dummy+0x28>
 80485e9: b8 00 00 00 00        mov    $0x0,%eax
 80485ee: 85 c0                test   %eax,%eax
 80485f0: 74 16                je     8048608 <frame_dummy+0x28>
 80485f2: 55                    push   %ebp
 80485f3: 89 e5                mov    %esp,%ebp
 80485f5: 83 ec 18              sub    $0x18,%esp
 80485f8: c7 04 24 08 9f 04 08 movl   $0x8049f08,(%esp)
 80485ff: ff d0                call   *%eax
 8048601: c9                    leave 
 8048602: e9 79 ff ff ff        jmp    8048580 <register_tm_clones>
 8048607: 90                    nop
 8048608: e9 73 ff ff ff        jmp    8048580 <register_tm_clones>
 804860d: 66 90                xchg   %ax,%ax
 804860f: 90                    nop

08048610 <main>:
 8048610: 55                    push   %ebp
 8048611: 89 e5                mov    %esp,%ebp
 8048613: 83 e4 f0              and    $0xfffffff0,%esp
 8048616: 81 ec 30 04 00 00    sub    $0x430,%esp
 804861c: c7 84 24 2c 04 00 00 movl   $0x0,0x42c(%esp)
 8048623: 00 00 00 00
 8048627: c7 84 24 28 04 00 00 movl   $0x0,0x428(%esp)
 804862e: 00 00 00 00
 8048632: 83 7d 08 02          cmpl   $0x2,0x8(%ebp)
 8048636: 74 1f                je     8048657 <main+0x47>
 8048638: 8b 45 0c              mov    0xc(%ebp),%eax
 804863b: 8b 00                mov    (%eax),%eax
 804863d: 89 44 24 04          mov    %eax,0x4(%esp)
 8048641: c7 04 24 80 88 04 08 movl   $0x8048880,(%esp)
 8048648: e8 23 fe ff ff        call   8048470 <printf@plt>
 804864d: b8 01 00 00 00        mov    $0x1,%eax
 8048652: e9 8c 01 00 00        jmp    80487e3 <main+0x1d3>
 8048657: c7 44 24 08 00 04 00 movl   $0x400,0x8(%esp)
 804865e: 00
 804865f: c7 44 24 04 30 00 00 movl   $0x30,0x4(%esp)
 8048666: 00
 8048667: 8d 44 24 28          lea    0x28(%esp),%eax
 804866b: 89 04 24              mov    %eax,(%esp)
 804866e: e8 5d fe ff ff        call   80484d0 <memset@plt>
 8048673: c7 44 24 08 00 00 00 movl   $0x0,0x8(%esp)
 804867a: 00
 804867b: c7 44 24 04 01 00 00 movl   $0x1,0x4(%esp)
 8048682: 00
 8048683: c7 04 24 02 00 00 00 movl   $0x2,(%esp)
 804868a: e8 51 fe ff ff        call   80484e0 <socket@plt>
 804868f: 89 84 24 2c 04 00 00 mov    %eax,0x42c(%esp)
 8048696: 83 bc 24 2c 04 00 00 cmpl   $0x0,0x42c(%esp)
 804869d: 00
 804869e: 79 16                jns    80486b6 <main+0xa6>
 80486a0: c7 04 24 a0 88 04 08 movl   $0x80488a0,(%esp)
 80486a7: e8 f4 fd ff ff        call   80484a0 <puts@plt>
 80486ac: b8 01 00 00 00        mov    $0x1,%eax
 80486b1: e9 2d 01 00 00        jmp    80487e3 <main+0x1d3>
 80486b6: c7 44 24 08 10 00 00 movl   $0x10,0x8(%esp)
 80486bd: 00
 80486be: c7 44 24 04 30 00 00 movl   $0x30,0x4(%esp)
 80486c5: 00
 80486c6: 8d 44 24 18          lea    0x18(%esp),%eax
 80486ca: 89 04 24              mov    %eax,(%esp)
 80486cd: e8 fe fd ff ff        call   80484d0 <memset@plt>
 80486d2: 66 c7 44 24 18 02 00 movw   $0x2,0x18(%esp)
 80486d9: c7 04 24 88 13 00 00 movl   $0x1388,(%esp)
 80486e0: e8 ab fd ff ff        call   8048490 <htons@plt>
 80486e5: 66 89 44 24 1a        mov    %ax,0x1a(%esp)
 80486ea: 8b 45 0c              mov    0xc(%ebp),%eax
 80486ed: 83 c0 04              add    $0x4,%eax
 80486f0: 8b 00                mov    (%eax),%eax
 80486f2: 8d 54 24 18          lea    0x18(%esp),%edx
 80486f6: 83 c2 04              add    $0x4,%edx
 80486f9: 89 54 24 08          mov    %edx,0x8(%esp)
 80486fd: 89 44 24 04          mov    %eax,0x4(%esp)
 8048701: c7 04 24 02 00 00 00 movl   $0x2,(%esp)
 8048708: e8 73 fd ff ff        call   8048480 <inet_pton@plt>
 804870d: 85 c0                test   %eax,%eax
 804870f: 7f 16                jg     8048727 <main+0x117>
 8048711: c7 04 24 c3 88 04 08 movl   $0x80488c3,(%esp)
 8048718: e8 83 fd ff ff        call   80484a0 <puts@plt>
 804871d: b8 01 00 00 00        mov    $0x1,%eax
 8048722: e9 bc 00 00 00        jmp    80487e3 <main+0x1d3>
 8048727: c7 44 24 08 10 00 00 movl   $0x10,0x8(%esp)
 804872e: 00
 804872f: 8d 44 24 18          lea    0x18(%esp),%eax
 8048733: 89 44 24 04          mov    %eax,0x4(%esp)
 8048737: 8b 84 24 2c 04 00 00 mov    0x42c(%esp),%eax
 804873e: 89 04 24              mov    %eax,(%esp)
 8048741: e8 ba fd ff ff        call   8048500 <connect@plt>
 8048746: 85 c0                test   %eax,%eax
 8048748: 79 16                jns    8048760 <main+0x150>
 804874a: c7 04 24 dd 88 04 08 movl   $0x80488dd,(%esp)
 8048751: e8 4a fd ff ff        call   80484a0 <puts@plt>
 8048756: b8 01 00 00 00        mov    $0x1,%eax
 804875b: e9 83 00 00 00        jmp    80487e3 <main+0x1d3>
 8048760: eb 36                jmp    8048798 <main+0x188>
 8048762: 8d 54 24 28          lea    0x28(%esp),%edx
 8048766: 8b 84 24 28 04 00 00 mov    0x428(%esp),%eax
 804876d: 01 d0                add    %edx,%eax
 804876f: c6 00 00              movb   $0x0,(%eax)
 8048772: a1 40 a0 04 08        mov    0x804a040,%eax
 8048777: 89 44 24 04          mov    %eax,0x4(%esp)
 804877b: 8d 44 24 28          lea    0x28(%esp),%eax
 804877f: 89 04 24              mov    %eax,(%esp)
 8048782: e8 69 fd ff ff        call   80484f0 <fputs@plt>
 8048787: 83 f8 ff              cmp    $0xffffffff,%eax
 804878a: 75 0c                jne    8048798 <main+0x188>
 804878c: c7 04 24 f7 88 04 08 movl   $0x80488f7,(%esp)
 8048793: e8 08 fd ff ff        call   80484a0 <puts@plt>
 8048798: c7 44 24 08 ff 03 00 movl   $0x3ff,0x8(%esp)
 804879f: 00
 80487a0: 8d 44 24 28          lea    0x28(%esp),%eax
 80487a4: 89 44 24 04          mov    %eax,0x4(%esp)
 80487a8: 8b 84 24 2c 04 00 00 mov    0x42c(%esp),%eax
 80487af: 89 04 24              mov    %eax,(%esp)
 80487b2: e8 a9 fc ff ff        call   8048460 <read@plt>
 80487b7: 89 84 24 28 04 00 00 mov    %eax,0x428(%esp)
 80487be: 83 bc 24 28 04 00 00 cmpl   $0x0,0x428(%esp)
 80487c5: 00
 80487c6: 7f 9a                jg     8048762 <main+0x152>
 80487c8: 83 bc 24 28 04 00 00 cmpl   $0x0,0x428(%esp)
 80487cf: 00
 80487d0: 79 0c                jns    80487de <main+0x1ce>
 80487d2: c7 04 24 0d 89 04 08 movl   $0x804890d,(%esp)
 80487d9: e8 c2 fc ff ff        call   80484a0 <puts@plt>
 80487de: b8 00 00 00 00        mov    $0x0,%eax
 80487e3: c9                    leave 
 80487e4: c3                    ret   
 80487e5: 66 90                xchg   %ax,%ax
 80487e7: 66 90                xchg   %ax,%ax
 80487e9: 66 90                xchg   %ax,%ax
 80487eb: 66 90                xchg   %ax,%ax
 80487ed: 66 90                xchg   %ax,%ax
 80487ef: 90                    nop

080487f0 <__libc_csu_init>:
 80487f0: 55                    push   %ebp
 80487f1: 57                    push   %edi
 80487f2: 31 ff                xor    %edi,%edi
 80487f4: 56                    push   %esi
 80487f5: 53                    push   %ebx
 80487f6: e8 45 fd ff ff        call   8048540 <__x86.get_pc_thunk.bx>
 80487fb: 81 c3 05 18 00 00    add    $0x1805,%ebx
 8048801: 83 ec 1c              sub    $0x1c,%esp
 8048804: 8b 6c 24 30          mov    0x30(%esp),%ebp
 8048808: 8d b3 04 ff ff ff    lea    -0xfc(%ebx),%esi
 804880e: e8 11 fc ff ff        call   8048424 <_init>
 8048813: 8d 83 00 ff ff ff    lea    -0x100(%ebx),%eax
 8048819: 29 c6                sub    %eax,%esi
 804881b: c1 fe 02              sar    $0x2,%esi
 804881e: 85 f6                test   %esi,%esi
 8048820: 74 27                je     8048849 <__libc_csu_init+0x59>
 8048822: 8d b6 00 00 00 00    lea    0x0(%esi),%esi
 8048828: 8b 44 24 38          mov    0x38(%esp),%eax
 804882c: 89 2c 24              mov    %ebp,(%esp)
 804882f: 89 44 24 08          mov    %eax,0x8(%esp)
 8048833: 8b 44 24 34          mov    0x34(%esp),%eax
 8048837: 89 44 24 04          mov    %eax,0x4(%esp)
 804883b: ff 94 bb 00 ff ff ff call   *-0x100(%ebx,%edi,4)
 8048842: 83 c7 01              add    $0x1,%edi
 8048845: 39 f7                cmp    %esi,%edi
 8048847: 75 df                jne    8048828 <__libc_csu_init+0x38>
 8048849: 83 c4 1c              add    $0x1c,%esp
 804884c: 5b                    pop    %ebx
 804884d: 5e                    pop    %esi
 804884e: 5f                    pop    %edi
 804884f: 5d                    pop    %ebp
 8048850: c3                    ret   
 8048851: eb 0d                jmp    8048860 <__libc_csu_fini>
 8048853: 90                    nop
 8048854: 90                    nop
 8048855: 90                    nop
 8048856: 90                    nop
 8048857: 90                    nop
 8048858: 90                  nop
 8048859: 90                    nop
 804885a: 90                    nop
 804885b: 90                    nop
 804885c: 90                    nop
 804885d: 90                  nop
 804885e: 90                    nop
 804885f: 90                  nop

08048860 <__libc_csu_fini>:
 8048860: f3 c3                repz ret
 8048862: 66 90                xchg   %ax,%ax

Desensamblado de la sección .fini:

08048864 <_fini>:
 8048864: 53                    push   %ebx
 8048865: 83 ec 08              sub    $0x8,%esp
 8048868: e8 d3 fc ff ff        call   8048540 <__x86.get_pc_thunk.bx>
 804886d: 81 c3 93 17 00 00    add    $0x1793,%ebx
 8048873: 83 c4 08              add    $0x8,%esp
 8048876: 5b                    pop    %ebx
 8048877: c3                    ret

Como pueden ver el codigo es algo extenso pero esta como que dividido en partes y además contiene estos subtítulos

Desensamblado de la sección .plt
Desensamblado de la sección .text
Desensamblado de la sección .fini

Tambien hay que analizar estos para entender el programa??
3  Foros Generales / Dudas Generales / Como se interpreta este comando?? en: 17 Mayo 2014, 23:13 pm
Hola, ya estoy en la parte de \Run podria alguien explicarme que tengo que hacer en la parte de /vsyst32/tReg_SZ/d



http://www.subirimagenes.com/imagen-faltanunospasos-8917611.html


Gracias por leer, se que no es muy claro, pero no se como mas escribirlo...
4  Programación / Programación C/C++ / Duda LECTURA ARCHIVOS BINARIOS en: 11 Mayo 2014, 20:01 pm
Buen Día, mi duda es acerca de la lectura de archivos Binarios, este es el código:

Código
  1. void CargarInformacion(struct TNodo<Usuarios> **Lista)
  2. {
  3.     struct Usuarios Load;
  4.  
  5.     ifstream Datos("Base De Datos.dat", ios::binary);
  6.  
  7.     if (Datos.good())
  8.        while (!Datos.eof())
  9.              if ( Datos.read((char*)&Load, sizeof(Load)) )
  10.                 InsertarFinal(Lista, Load);
  11.  
  12.     Datos.close();
  13. }
  14.  

La Funcion funciona!!! pero no se por que hay que colocar esto

Código
  1. Datos.read((char*)&Load, sizeof(Load))


dentro de un if, le pregunte a alguien pero me dice que es para que no lea 2 veces lo mismo, pero esa es la duda... por que????


Gracias por su tiempo.  ;)
5  Programación / Programación C/C++ / Realmente extraño problema con cin.getline en: 11 Abril 2014, 01:13 am
Hola Buenas, el problema es que en mi código en la LINEA 20,cin.getline pasa de largo y no ejecuta la instrucción de leer, ya he depurado el código con Dev C++ pero es realmente extraño.

El error ÚNICAMENTE SUCEDE al escoger primero la opción 2 y después intentar con la 1.

Aquí esta la porción de código.
Código
  1.    while (Opcion!=3)
  2.    {
  3.          cout<<"Menu Principal\n\n";
  4.  
  5.          cout<<"1. Ingresar a Facebook";
  6.          cout<<"2. Crear una cuenta"<<endl;
  7.          cout<<"3. Salir\n\n\n";
  8.  
  9.          CharOp=getch();//Lee un caracter sin presionar enter y sin mostrarlo en pantalla
  10.  
  11.          if (CharOp=='1')
  12.          {
  13.             Opcion=1;//Se Decrara para mantener la condicion while principal
  14.             system("cls");
  15.  
  16.             Intentos=0;
  17.             while (Intentos!=3)
  18.             {            
  19.                   gotoxy(30,10);cout<<"Usuario: ";
  20.                   cin.getline(User,10,'\n');
  21.  
  22.                   Validacion=BuscarLista(&ListaUsuarios, User, 1);//Validacion Se Encarga de ver si el Usuario Existe,
  23.                   if ( Validacion==false )
  24.                   {
  25.                      gotoxy(39,12);cout<<"ID no encontrada!!!"<<endl;
  26.                      Sleep(1500);
  27.                      //Borra Los Espacios Incorrectos Para Un Nuevo Intento
  28.                      gotoxy(39,10);cout<<"                         ";
  29.                      gotoxy(39,12);cout<<"                         ";
  30.                      gotoxy(28,10);textcolor(12);cout<<char(219);
  31.                      Intentos+=1;
  32.                   }
  33.                   else
  34.                       Intentos=3;
  35.             }
  36.  
  37.          }
  38.  
  39.          if (CharOp=='2')
  40.          {
  41.             Opcion=2;//Se Decrara para mantener la condicion while principal
  42.  
  43.             cout<<"Nombre: ";
  44.             cin.getline(CuentaNueva.Nombre, 20,'\n');
  45.             cout<<"ID: ";
  46.             cin.getline(CuentaNueva.ID, 10,'\n');
  47.             cout<<"Contrase"<<char(164)<<"a: ";
  48.             cin.getline(CuentaNueva.Contrasenia, 10,'\n');
  49.             cout<<"Genero (M - F): ";//AQUI ESTA EL ERROR????
  50.             cin>>CuentaNueva.Genero;
  51.             cout<<"Edad: ";
  52.             cin>>CuentaNueva.Edad;
  53.             cout<<"Documento: ";
  54.             cin>>CuentaNueva.Documento;
  55.  
  56.             InsertarFinal(&ListaUsuarios, CuentaNueva);
  57.          }
  58.  
  59.          if (CharOp=='3')
  60.             Opcion=3;//Se Decrara para mantener la condicion while principal
  61.  
  62.          system("cls");
  63.    }
  64.  

Si no me hago entender por favor descarguen el ejecutable
https://mega.co.nz/#!Btx2URJb!Dsr7oOEZx5RfvQkVlEAAv5gSw40uD2FEw-Uxh1mQJ9I

Aqui el link del codigo
https://mega.co.nz/#!owZQHZjB!QLbJo-EUYFfucYX2Mnn2GoBqzA56PLwqa1BYo4996Fs
6  Programación / Programación C/C++ / Duda Manejo De Archivos De Acceso Aleatorio en: 31 Marzo 2014, 20:28 pm
La duda es que tengo un archivo de texto asi:

Lucas Gnneco
Omar Rodriguez
Laura Monroy


y lo que quiero es que atravez del manejo de archivos sin sobreescribir nada meter un nombre por ejemplo entre Omar y Laura.


Lucas Gnneco
Omar Rodriguez
Pepito Perez
Laura Monroy


con acceso secuencial no me funciono, asi que creo que es con acceso aleatorio con seekg y seekp pero la verdad no he podido, podria alguien orientarme por favor.
7  Programación / Programación C/C++ / Asesoria Memoria Dinamica en: 11 Marzo 2014, 21:59 pm
Hola, estoy haciendo un programa para contar el numero de palabras que tenga una frase, el problema es que por supuesto siempre el numero de palabras varia, por lo que segun pienso yo, hay que usar memoria dinamica

Código
  1. int main(int argc, char *argv[])
  2. {
  3.    char Lectura[200], *PTok, **Palabras=NULL;
  4.    int i=0, j=0, ContPal=1;
  5.  
  6.    cin.getline(Lectura, sizeof(Lectura));
  7.  
  8.    PTok=strtok(Lectura," ");
  9.  
  10.    while ( PTok!= NULL )
  11.    {
  12.          AgrEspacio(Palabras, ContPal);//AgrEspacio Agrega Una Fila De Mas A Palabras
  13.          strcpy( Palabras[i], PTok );
  14.          PTok=strtok(NULL," ");
  15.          i+=1;
  16.          ContPal+=1;
  17.    }
  18.  
  19.    for ( j=0; j<i; j++ )
  20.        cout<<Palabras[j]<<endl;
  21.  
  22.    system("PAUSE");
  23.    return EXIT_SUCCESS;
  24. }


El problema como tal es esa funcion para agregar una fila a la matriz, ya que si compila, pero estoy violando el acceso a la memoria en una parte del codigo de esa funcion

Código
  1. void AgrEspacio ( char **Palabras, int NumPal)
  2. {
  3.     char **TemFilas=new char*[NumPal];
  4.  
  5.     for ( int i=0; i<NumPal; i++ )
  6.     {
  7.         TemFilas[i]=new char[200];  
  8.         TemFilas[i]=Palabras[i];
  9.     }
  10.  
  11.     Palabras=TemFilas;  
  12. }
La verdad este tema de memoria dinamica se me hace un poco dificil de entender, ya que no se bien cuando es correcto usarla, por ejemplo en este ejercicio podria haber creado una matriz estatica como
Código
  1. char Palabras[100][200];
en vez de pensar en memoria dinamica, pero la ventaja es que con esta voy agregando filas a mi matriz cuando lo voy necesitando en vez de declarar una estatica y ocupar memoria que tal vez no usare

Gracias por su tiempo.
8  Programación / Programación C/C++ / Problema Con Un Arreglo Dinamico [?] en: 16 Octubre 2013, 01:31 am
El codigo compila pero el ejecutable no funciona tal como la imagen de el link

Código
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. struct Item{
  7.       int Peso;
  8.       int Volumen;
  9.       string Nombre;
  10. };
  11.  
  12. struct Maleta{
  13.       int Peso;
  14.       int Volumen;
  15.       int Cantidad_Items;
  16.       Item *Items;
  17. };
  18.  
  19. int main(int argc, char *argv[])
  20. {
  21.    Maleta *Mi_Maleta=new Maleta[10];
  22.    Mi_Maleta->Items=new Item[10];
  23.  
  24.    Mi_Maleta[1].Items[0].Nombre="Peras";
  25.    Mi_Maleta[1].Items[0].Volumen=12;
  26.    Mi_Maleta[1].Items[0].Peso=16;
  27.  
  28.  
  29.    system("PAUSE");
  30.    return EXIT_SUCCESS;
  31. }
http://www.subirimagenes.com/imagen-imagen1-8658261.html
9  Programación / Programación C/C++ / Asignar Mas Memoria A Un Arreglo Dinamico en: 2 Septiembre 2013, 22:36 pm
En el main tengo un arreglo de tamaño 1 pero necesito que este incremente su tamaño a medida que el usuario digite mas y mas datos...

Código:
#include <cstdlib>
#include <iostream>
#include <string>
#include <conio.h>

using namespace std;

struct Datos {
       string Nombre;
       int Edad;
};

struct Categorias {
       string Deporte;
       int Atletas;
       Datos Informacion;
};

void Ingresar_Deportista ( Categorias *Deportes, int Cant_Deportes );

int main(int argc, char *argv[])
{   
    int Num_Deportes=1; //Tamaño Variable - Cambia En Tiempo De Ejecucion
    Categorias *Deportes= new Categorias[Num_Deportes];

    Ingresar_Deportista( Deportes, Num_Deportes );
   
    system("PAUSE");
    return EXIT_SUCCESS;
}

Ese incremento de tamaño lo implemente en la funcion Ingresar_Deportista justo al final

Código:
void Ingresar_Deportista ( Categorias *Deportes, int Cant_Deportes ){
     
     int i=0, Aux=0;
     char Opcion='s';
     
     while(Opcion=='s'){
     cout<<"Deporte: ";
     cin>>Deportes[i].Deporte;
     cout<<"\nNombre: ";
     cin>>Deportes[i].Informacion.Nombre;
     cout<<"Edad: ";
     cin>>Deportes[i].Informacion.Edad;
     cout<<"\nIngresar Mas? Si(s) ";
     Opcion=getch();
     i+=1;
     system("cls");
     
//Si Supera El Tamaño Maximo (Darle Mas Memoria Al Arreglo Dinamico)

     if( i>=Cant_Deportes ){
         Categorias *Agrandar= new Categorias[Cant_Deportes+1];
         for(Aux=0; Aux<Cant_Deportes; Aux++)
         Agrandar[Aux]=Deportes[Aux];
         Deportes=Agrandar;}
     }
}

El codigo compila pero despues de ingresar el tercer deporte el ejecutable se totea, a que se debe esto?
10  Programación / Programación C/C++ / Problema Con Un Arreglo Dinamico De Estructuras [?] en: 2 Septiembre 2013, 18:56 pm
#include <cstdlib>
#include <iostream>


using namespace std;

struct Datos {
       char *Nombre;
       int Edad;
};

struct Categorias {
       char *Deporte;
       int Atletas;
       Datos *Informacion;
};

int main(int argc, char *argv[])
{  
    Categorias *Otro= new Categorias[10];
    
    Otro[0].Informacion->Nombre="Oscar";
        
    system("PAUSE");
    return EXIT_SUCCESS;
}


Pordrian por favor ayudarme .. el codigo compila pero el ejecutable se totea
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines