Commit a366a1ea by rakein

8feb17

parents
#include <stdio.h>
#include <string.h>
int main (void)
{
char fp;
fp = fopen("andmed.txt", "r");
char str[1000] = fp;
const char s[2] = " ";
char *bleach;
bleach = strtok(str, s);
while( bleach != NULL)
{
printf( "%s\n", bleach);
bleach = strtok(NULL, s);
}
}
#include <stdio.h>
#include <stdlib.h>
#define P 10
void failiarv(char nim[], int as[])
{
char nimi[P];
int i;
FILE *fi;
fi = fopen("numbrid.txt", "r");
for(i = 0; i <= 15; i++)
{
fscan(fi, "%d", &as[i]);
printf("%d",fi);
}
}
Karl 22.5 00
Teet 34.5 01
Siim 125.7 01
Kertu -325.6 01
Kai 174 01
Timo 444 00
Lucifer 666 11
Allah 555.9 25
Kalle 123453.53 01
Mai 55.23 41
Tiina 154 55
Urve 1035 44
Peet 22.5 00
Teet 34.5 01
Erki 125.7 01
Nool -325.6 01
Vai 174 01
Tigo 444 00
Stiffler 0.01 11
Allah 555.9 25
Mai 55.23 -41
Tiina 154 55
Urve 1055535 44
Sepo -52.63 01
Kaspar 23.52 01
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
9
1
2
1
4
Karl 22.5 00
Teet 34.5 01
Siim 125.7 01
Kertu -325.6 01
Kai 174 01
Timo 444 00
Lucifer 666 11
Allah 555.9 25
Kalle 123453.53 01
Mai 55.23 41
Tiina 154 55
Urve 1035 44
Peet 22.5 00
Teet 34.5 01
Erki 125.7 01
Nool -325.6 01
Vai 174 01
Tigo 444 00
Stiffler 0.01 11
Allah 555.9 25
Mai 55.23 -41
Tiina 154 55
Urve 1055535 44
Sepo -52.63 01
Kaspar 23.52 01
#include <unistd.h>
#include <stdio.h>
void checkFile(const *char avatavFail)
{
if( access( &avatavFail, F_OK ) != -1 ) {
return 1;
} else {
return 0;
}
#define
int main ()
{
Inimesed Isik;
Inimesed Isik_Array[Row];
char *inputFilename = "andmed.txt";
char *outputFilename = "tulemused.txt";
char *checkCode = "01";
double *checkmoney = 50,0;
int counter = 0;
int i = 0;
if (checkFile(inputFilename) == 1)
{
FILE *input = fopen(inputFilename, "r");
FILE *output = fopen(outputFilename, "w");
} else {
printf("sellist faili pole olemas");
}
while (1)
{
fscanf(input, "%s %lf %s", &Isik.nimi, &Isik.raha, &Isik.kood);
if(feof(input))break;
}
}
#include <stdio.h>
#include <stdio.h>
#include <string.h>
typedef struct {
char nimi;
char tyyKoht;
char sutus;
int telNr;
}kirjed;
void main()
{
struct kirjed kirje1;
struct kirjed kirje2;
struct kirjed kirje3;
strcpy(kirje1.nimi, /**kutsu funktsioon mis vtab failist f1 otsitud suuruse**/);
strcpy(kirje1.tyyKoht, "-");
strcpy(kirje1.asutus, "-");
strcpy(kirje1.telNr, "-");
return 0;
}
#include <stdlib.h>
#include <math.h>
int arvuGeneraator()
{
int i;
int genArv;
for(i = 0; i < 1; i++)
{
srand(time(NULL));
genArv = ( rand()%17 ) + 1;
/**printf("%d \n", genArv);**/
}
return genArv;
}
#include<stdio.h>
void failiGeneraator()
{
char *failiNimi;
printf("Sisesta faili nimi kujul 'faili_nimi.txt'\n");
scanf("%s", &failiNimi);
FILE *fail = fopen(&failiNimi, "w");
fclose(fail);
return 0;
}
#include <stdio.h>
#include <unistd.h>
#include "arvuGeneraator.h"
void main()
{
char *avatavFail;
printf("Sisestage faili nimi, kuhu soovite kirjuada. (nt 'faili_nimi.txt')\n");
scanf("%s", &avatavFail);
if( access( &avatavFail, F_OK ) != -1 ) {
printf("Fail on olemas");
FILE *fail = fopen(&avatavFail, "w");
printf("viga1");
fprintf(&avatavFail, "%d", arvuGeneraator());
printf("viga2");
fclose(fail);
printf("viga3");
} else {
printf("Faili ei ole olemas.");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment