nieco
This commit is contained in:
45
stringyreloaded.c
Normal file
45
stringyreloaded.c
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// Created by bruno on 3/18/24.
|
||||
//
|
||||
|
||||
#include "stringyreloaded.h"
|
||||
#include "curses.h"
|
||||
#include "string.h"
|
||||
|
||||
int stringyreloaded() {
|
||||
char meno[64];
|
||||
char adresa[64];
|
||||
char telefon[10];
|
||||
|
||||
char *s1 = "Ahoj";
|
||||
char s2[21];
|
||||
|
||||
FILE *fw;
|
||||
fw = fopen("test.txt", "w");
|
||||
|
||||
strcpy(s2, "Hello");
|
||||
strcat(s2, " + ");
|
||||
strcat(s2, s1);
|
||||
|
||||
fprintf(fw, "Dĺžka reťazca %s je %lu.\n", s1, strlen(s1));
|
||||
fprintf(fw, "Dĺžka reťazca %s je %lu.\n", s2, strlen(s2));
|
||||
|
||||
|
||||
initscr();
|
||||
clear();
|
||||
puts("Zadaj meno a priezvisko: ");
|
||||
getnstr(meno, 63);
|
||||
puts("Zadaj adresu: ");
|
||||
getnstr(adresa, 63);
|
||||
puts("Zadaj telefón: ");
|
||||
getnstr(telefon, 9);
|
||||
fputs("Zadal si:\n", fw);
|
||||
fputs(meno, fw);
|
||||
fputc('\n', fw);
|
||||
fputs(adresa, fw);
|
||||
fputc('\n', fw);
|
||||
fputs(telefon, fw);
|
||||
fputc('\n', fw);
|
||||
fclose(fw);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user