Einlesefunktion hinzugefügt
This commit is contained in:
parent
e58f113c46
commit
b903897245
8
Start_Windows/.idea/Start_Windows.iml
generated
8
Start_Windows/.idea/Start_Windows.iml
generated
@ -1,8 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="CPP_MODULE" version="4">
|
<module classpath="CIDR" type="CPP_MODULE" version="4" />
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
||||||
@ -8,5 +9,26 @@
|
|||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
|
char zeile[MAX_LINE_LEN];
|
||||||
|
char* teiler = ".;, ";
|
||||||
|
int wordCount = 0;
|
||||||
|
char* token;
|
||||||
|
printf("Datei geöffnet\n");
|
||||||
|
while(fgets(zeile, MAX_LINE_LEN, file)!=NULL)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1024; i++)
|
||||||
|
if (zeile[i] == '\n') {
|
||||||
|
zeile[i] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
token = strtok(zeile,teiler);
|
||||||
|
while(token != NULL)
|
||||||
|
{
|
||||||
|
strcpy(words[wordCount],token);
|
||||||
|
token = strtok(NULL,teiler);
|
||||||
|
wordCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wordCount;
|
||||||
}
|
}
|
||||||
29
ersz004z80vDesktopc projectsI2 PraktikumAufgabe1-Info2P
Normal file
29
ersz004z80vDesktopc projectsI2 PraktikumAufgabe1-Info2P
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[33mcommit e58f113c46c1af49c3680b6da5cc999b56b0093a[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mmain[m[33m, [m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m)[m
|
||||||
|
Author: Kruschat <max.kruschat@siemens.com>
|
||||||
|
Date: Thu Oct 23 14:55:49 2025 +0200
|
||||||
|
|
||||||
|
Test geändert
|
||||||
|
|
||||||
|
[33mcommit 89ca3acc38758a65a28a874ceda5d3253c1cb6d8[m
|
||||||
|
Author: Bannach <kevin.bannach@siemens.com>
|
||||||
|
Date: Thu Oct 23 14:54:03 2025 +0200
|
||||||
|
|
||||||
|
Testdatei
|
||||||
|
|
||||||
|
[33mcommit 15db90e12e6413714750ac23a78aa369bf192a22[m
|
||||||
|
Author: Bannach <kevin.bannach@siemens.com>
|
||||||
|
Date: Thu Oct 23 14:52:08 2025 +0200
|
||||||
|
|
||||||
|
Testdatei aktualisiert
|
||||||
|
|
||||||
|
[33mcommit b804c4264c21980ba6497fb76da0da6151c1b9ed[m
|
||||||
|
Author: Bannach <kevin.bannach@siemens.com>
|
||||||
|
Date: Wed Oct 22 20:57:00 2025 +0200
|
||||||
|
|
||||||
|
Textdatei Test hinzugefügt
|
||||||
|
|
||||||
|
[33mcommit 496e4d82e75945b8899aa012e0039034f40a1db1[m
|
||||||
|
Author: Kevin Bannach <bannachke98909@th-nuernberg.de>
|
||||||
|
Date: Wed Oct 22 07:21:52 2025 +0000
|
||||||
|
|
||||||
|
Initial commit
|
||||||
Loading…
x
Reference in New Issue
Block a user