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

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / [AYUDA] PROBLEMA CON ARRAYS en: 18 Marzo 2019, 12:53 pm
Me gustaria saber como soluciono este error de compilado , llevo horas buscando y no lo encuentro  :-(
paso codigo:

#include <stdio.h>
#include <stdlib.h>
 struct {
   char *nick,*nombre,*pswd;
   int nivel,vida,escudo;
}jug;
enum estado{OFF,ON,EJ,EE,GO};
enum acceso{ADM,JGD};
int main ( void ){

   FILE *jugadores ;
 struct jug registrojug[34];// AQUI ME FALLA
   int i,jug,j;
   char palabra[15],cad[80];

       jugadores= fopen( "jugadores.txt" , "a" );

       if ( jugadores == NULL ){
             printf( "Error en la creacion del archivo" );
       }
         while ( jug == 1 ){
            printf( "Introduce los datos del jugador\n\n" );
            printf( "1º Introduce el nick\n" );
            printf( "2º Introuduce el nombre\n" );
            printf( "3º Intoduce la contraseña (debe tener minimo 8 caracteres)\n\n" );
            for( i = 0 ; i < 11 ; i++ ){

               if ( i == 1 ){//para el nick
                  scanf( "%s", &registrojug[j].nick );

                  fflush( stdin );
                  sprintf( cad, "%s", registrojug[j].nick );
                  fputs( cad, jugadores );
               }
               if ( i ==2 ){
                  scanf( "%s", &registrojug[j].nombre );

                  fflush( stdin );
                  sprintf( cad, "%s",registrojug[j].nombre );
                  fputs( cad, jugadores );
               }
               if ( i == 3 ){
                  scanf( "%s", registrojug[j].pswd );

                  fflush( stdin );
                  sprintf( cad, "%s",registrojug[j].pswd );
                  fputs( cad, jugadores );
               }
               if( i == 4 ){https://stackoverflow.com/questions/1102542/how-to-define-an-enumerated-type-enum-in-c
                  fputs( "1", jugadores );
               }
               if( i == 9 ){
                  fputs( "450", jugadores );
               }
               if( i >= 10){
                  fputs( "0", jugadores );
                  }
               fputs( "/", jugadores );
            }
            fputs( "\n", jugadores );
            printf( "¿ Desea introducir otro jugador ?\n" );
            printf( "si===>1  no===>cualquier cosa" );
            scanf( "%i", &jug );
            printf( "\n\n\n" );
         }
}
2  Programación / Programación C/C++ / ayuda con un programa de ficheros en: 13 Marzo 2019, 16:11 pm
Como podría hacer para que me mostrara el contenido de una línea que el strtoken detecta ?, adjunto el .c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (){
   int i,j;
   char *token;
   char arma[20],buffer[300];
      FILE *objetos ;
      objetos=fopen( "Objetos.txt" , "r" );
      if (objetos == NULL){

             printf( "Error en la lectura del archivo\n" );

       }
      else {//ENCUENTRA EL ARMA EN EL FICHERO
      do{
      
         printf("Introduzca el nombre del objeto\n");
         scanf("%s",arma);
         do{
            fgets(buffer,300,objetos);
            token=strtok(buffer,"/");
            
               if (strcmp(arma,token)==NULL){
                     
                     printf("Tiene estas carateristcas");
                        //mostrar caracteristicas aqui, quiero mostrar la linea que ha detectado el token
                     printf("¿Desea introducir otro objeto?\n    Si==>1  No==>otra tecla\n");
                     scanf("%i",&j);
                     
               }
               else{ printf("No se ha encontrado el objeto\n vuelva a introducir el nombre\n\n");
                              j=1;            
                  }
                        
            
         }while(feof(objetos));
      
      
         
         }while(j==1);   
}
}
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines