Hi guys I have problem with putting a multiple data to txt file.
For exemple I show you what I want:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct user{
char Name[256];
char Pass[7];
int ID;
}user1;
int main(){
printf ("Set name: ");
scanf ("%s",user1.Name)//I initialize as "QIZI"
printf ("Set password: ");
scanf ("%s",user1.Pass);//I initialize as "12345"
printf ("Set your's id: ");
scanf ("%s",user1.ID) //I initialize as 2
}
|
I have now initialized three variables, i want put in txt file like this:
Then I need get back that writen variables to struct user (from the txt file).
Can somebody help me ?
Last edited on
Thanks for answer, but I need some alternative way in stdio.h .