mmm el code esta bastante mal escrito..pero te felicito por empezar con C es lo mas grande q hay "para mi"
algo asi estaria mejor escrito:
#include <stdio.h>
#include <stdlib.h>
struct datos { //extructura
char nombre [15];// nombre del usuario
char pass [6];//password del usuario
}regin;
int i=0;
int main(){
FILE *pf;
pf = fopen("C:\\users.txt","ab");
if (pf==NULL){
printf ("ERROR DE LECTURA");
exit(1);
}
do{
printf("\nINGRESE NOMBRE DE USUARIO:");
scanf("%s",®in.nombre);
printf("\nINGRESE PASSWORD:");
scanf("%s",®in.pass);
if(strlen(regin.nombre)>14 || strlen(regin.pass)>5){ //evitamos un overflow
system("clear");
printf("Nombre o Password muy largos\n");
sleep(2);
system("clear");
}
else{
fprintf(pf,"usuario: %s\npass: %s\n\n",regin.nombre,regin.pass); /*escribimos en el archivo*/
fclose(pf); //y lo cerramos
i++;
}
}while (i==0);
system("clear");
printf("usuario Registrado\n");
}
Saludos...Taul.