This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Am Anfang müssen die Dateinamen im script gespeichert werden. Dazu nehme ich der Einfachheitshalber ein Array namens $bild. Die Funktion mt_rand() liefert eine Zufallszahl im Bereich unteres Array (also unterer Anzahl der eingetragenen Bilder). Mit der letzten Zeile wird der Wert aus dem Array $bild per PHP-Befehl "echo" in den HTML-Code geschrieben. | |
Um das Ganze nun nutzen zu können, musst du auf deinem Server diesen Quellcode in eine Datei mit der Endung .php speichern (sonst interpretiert der Server den Quelltext nicht als PHP). Wichtig dabei natürlich, dass dein Server überhaupt PHP installiert hat. Sollte aber mittlerweile überall Standard sein. | |
*/ | |
<?PHP | |
// Hier kommen die dateinamen untereinander | |
$bild[] = "header1.jpg"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// String definieren | |
string s1("Ein Text"); | |
// Zeichen aus String in char-Feld umkopieren | |
char charArray[40]; | |
// string.c_str() liefert char* | |
strcpy(charArray,s1.c_str()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
srand ( time(NULL) ); | |
int grA, grB; | |
grA = 0; grB = i; | |
int a; | |
a = grA + (rand() % (grB - grA + 1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int remove(const char *filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool DirectoryExists( const char* pzPath ){ | |
DIR *pDir; | |
bool bExists = false; | |
pDir = opendir (pzPath); | |
if (pDir != NULL){ | |
return true; | |
} | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns 0 if equal | |
stricmp(str1, str2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main(int argc, char *argv[]) | |
{ | |
ifstream f; // Datei-Handle | |
string s; | |
f.open(argv[1], ios::in); // Öffne Datei aus Parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CFile::search(fstream &FS) { | |
char savepath[MAX_PATH]; // zur Zwischenspeicherung des Pfades | |
int len; | |
WIN32_FIND_DATA FindFileData; | |
HANDLE hFind; | |
strcpy(savepath, path); // Sicherung des Pfades | |
strcat(path, "\\*"); | |
hFind = FindFirstFile(path, &FindFileData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Execute external program and get the return value | |
// Params have to be stored inside a string array | |
String[] params = {"cmd.exe", "/c", "dir"}; | |
Process process = Runtime.getRuntime().exec(params); | |
// Don't forget to close all streams! | |
process.getErrorStream().close(); | |
process.getInputStream().close(); | |
process.getOutputStream().close(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Returns the current date as Int in this form YYYYMMDD | |
*/ | |
int getCurDate(){ | |
String month = String.valueOf(month()); | |
if(month.length() == 1) month = "0" + month(); | |
String day = String.valueOf(day()); | |
if(day.length() == 1) day = "0" + day(); | |
return Integer.parseInt(year() + "" + month + "" + day); | |
} |
OlderNewer