-
Notifications
You must be signed in to change notification settings - Fork 0
/
pruebas.c
58 lines (48 loc) · 857 Bytes
/
pruebas.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
struct initialState
{
char user[100];
int pass;
int agua;
int luz;
float money;
float adelanto;
float transferencia;
float claro;
float movistar;
} initial[20];
void ficha() {
FILE *fp;
int c;
char array[100];
char array2[100];
int i = 1;
fp = fopen("users.txt","r");
if(fp == NULL) {
perror("Error in opening file");
return(-1);
}
fscanf(fp, "%s %s", initial[1].user, initial[2].user);
printf("%s\n", initial[1].user);
printf("%s", initial[2].user);
fclose(fp);
sleep(1);
newUser();
}
int newUser() {
FILE * new;
system("cls");
new = fopen("users.txt", "w");
fprintf(new, "Hola Mundo\n");
fclose(new);
sleep(5);
ficha();
}
int main()
{
ficha();
getch();
return 0;
}