•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 425,824 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,980 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 213 | Replies: 0 | Solved
![]() |
•
•
Join Date: Jan 2008
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I need to transfer data from file to fields... Can anyone help me?
file:
kód:
i know that i have it only by char, but if i will do it in integer, im also not able to do it
I think that right way is atoi() but Im not able to finish that... Can anyone help me? Thanks
I need to transfer data from file to fields... Can anyone help me?
file:
name surname weight age male/female name surname weight age male/female marek mixa 70 23 M ...
kód:
typedef struct lidi
{
char cl_jmeno[16], cl_prijmeni[21], cl_muz_zena[1],cl_vyska[3], cl_vaha[3];
} LIDI;
LIDI lidi[6];int nacti_lidi()
{
int i, j,lokace,cislo,;
char c;
printf("obsah souboru:\n");
for(i=0; i<2;i++) //dva radky
{
lokace = 1;
cislo = -1;
for(j=0; j<60; j++) //omezeni radku
{
c = getc(zdrojovysoubor);
if(c == '\n'){
printf("\n"); //vypisem obsah souboru
break;
}else{
if(c == ' '){
lokace ++; //udava co plnime za pole
printf(" ");
cislo = -1; //udava cislo v poli od nuly
continue;
}
cislo ++;
printf("%c", c ); //vypisem obsah souboru
if(lokace == 1){
lidi[i].cl_jmeno[cislo] = c;
}
else if(lokace == 2){
lidi[i].cl_prijmeni[cislo] = c;
}
else if(lokace == 3){
lidi[i].cl_vyska[cislo] = c;
}
else if(lokace == 4){
lidi[i].cl_vaha[cislo] = c;
}
else if(lokace == 5){
lidi[i].cl_muz_zena[cislo] = c;
}
}
}
}
printf("\n***********************************\n");
}I think that right way is atoi() but Im not able to finish that... Can anyone help me? Thanks
![]() |
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access advice broadband business classification code combo crime cult of the dead cow daniweb data data protection data transfer database drive dropdownlist encryption europe forensic forensics gadget google government hacking hard hardware help hitachi hp industrial espionage information internet linux mobile module net news payment services privacy protection reuse search security spot storage terabyte tutorials and more tv web wikipedia
- Please help with data file and array (C++)
- Help creating a data file (C)
- input data from a file into an Array (C)
- Reading from external data file (C++)
- data file help (C)
Other Threads in the C Forum
- Previous Thread: number of sol of n queen prob in c
- Next Thread: using a pointer to pointers


Linear Mode