"debut TD0"
This commit is contained in:
parent
ac93b9b2af
commit
cf00c53e65
9
2020-2021/S3T_TP_00_REVISIONS/Demo_make/bonjour.c
Executable file
9
2020-2021/S3T_TP_00_REVISIONS/Demo_make/bonjour.c
Executable file
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "util_afficher.h"
|
||||
int main (int argc, char * argv[], char * envp[])
|
||||
{
|
||||
if (argc != 2) {fprintf (stderr, "\nSyntaxe : %s <chaine> \n\n", argv[0]); exit (1); }
|
||||
afficher_chaine(argv[1]);
|
||||
}
|
||||
|
9
2020-2021/S3T_TP_00_REVISIONS/Demo_make/util_afficher.c
Executable file
9
2020-2021/S3T_TP_00_REVISIONS/Demo_make/util_afficher.c
Executable file
@ -0,0 +1,9 @@
|
||||
/*********************************/
|
||||
/* Specification afficher_chaine */
|
||||
/*********************************/
|
||||
#include <stdio.h>
|
||||
#include "util_afficher.h"
|
||||
void afficher_chaine (char * chaine) {
|
||||
printf ("\n\n*** %s ! ***\n\n", chaine);
|
||||
}
|
||||
|
5
2020-2021/S3T_TP_00_REVISIONS/Demo_make/util_afficher.h
Executable file
5
2020-2021/S3T_TP_00_REVISIONS/Demo_make/util_afficher.h
Executable file
@ -0,0 +1,5 @@
|
||||
/*********************************/
|
||||
/* Specification afficher_chaine */
|
||||
/*********************************/
|
||||
void afficher_chaine (char * chaine);
|
||||
|
18
2020-2021/S3T_TP_00_REVISIONS/crash.c
Executable file
18
2020-2021/S3T_TP_00_REVISIONS/crash.c
Executable file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main (int argc, char * argv[], char * envp[])
|
||||
{
|
||||
FILE *leFichier ;
|
||||
int n;
|
||||
// assert (argc == 2);
|
||||
if (argc != 2) {fprintf (stderr, "\nSyntaxe : %s <chaine> \n\n", argv[0]); exit (1); }
|
||||
leFichier = fopen (argv[1], "w");
|
||||
n = fwrite ("OK !\13\10\10\10\10", strlen ("OK !\13\10\10\10\10"), 1, leFichier);
|
||||
fclose ( leFichier);
|
||||
|
||||
printf ("\nhello %s\n\n", argc);
|
||||
printf ("\n\n\n Fin normale du programme\n\n");
|
||||
}
|
||||
|
11
2020-2021/S3T_TP_00_REVISIONS/hello.c
Executable file
11
2020-2021/S3T_TP_00_REVISIONS/hello.c
Executable file
@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
int main (int argc, char * argv[], char * envp[])
|
||||
{
|
||||
assert (argc == 2);
|
||||
//if (argc != 2) {fprintf (stderr, "\nSyntaxe : %s <chaine> \n\n", argv[0]); exit (1); }
|
||||
|
||||
printf ("\nhello %s\n\n", argv[1]);
|
||||
}
|
||||
|
15
2020-2021/S3T_TP_00_REVISIONS/processus_1.c
Executable file
15
2020-2021/S3T_TP_00_REVISIONS/processus_1.c
Executable file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
gcc processus_1.c
|
||||
Exemple : ./a.out un deux trois
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char * argv[]){
|
||||
int i;
|
||||
for (i=1; i< argc; i++) {
|
||||
printf("argument %d: %s\n",i,argv[i]);
|
||||
}
|
||||
printf("\nPID = %d - PPID = %d \n\n",getpid(), getppid());
|
||||
return 0;
|
||||
}
|
18
2020-2021/S3T_TP_00_REVISIONS/processus_2.c
Executable file
18
2020-2021/S3T_TP_00_REVISIONS/processus_2.c
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
gcc processus_2.c
|
||||
Exemple : ./a.out PATH
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf (stderr, "Syntaxe : %s <nom-de-variable>\n", argv[0]);
|
||||
exit (1);
|
||||
}
|
||||
printf ("\n%s\n\n", getenv (argv[1]));
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user