nom_spec.arr); else printf("
%-10s. %-30s %-2d" nom_cher.arr
fprintf(fich"%30s %20s"
printf("hello!
");. 5 exit(0);. 6. } Réponse hello hello hello hello fork fork fork. Fin réponse. • Question 2 : Même question pour le programme suivant.
13 : printf("
unsigned char a une taille de %d octets". 14 : sizeof(unsigned char)); 21 : scanf("%30s %30s"
printf("%-3d %-30s %d
" prs_n.mat
gets(fichier[n].tel); n++; printf("Nom : "); gets(name);. } } void afficher(void). { int i; for (i = 0; i < n; i++) printf("%30s : %20s
" fichier[i].nom
I/O: printf and scanf. File printf ( "%ld %ld %ld %s
" nl
dtrace -n 'ip:::send {printf(“%s” args[2]->ip_daddr);}' dtrace: description 'ip:::send printf(“ %30s %-6s %30s %-6s %-6s %s
”
printf "%-30s: %s %s %s
" "schedo current" `schedo -o vpm_fold_threshold` case $PROC_TYPE in. PowerPC_POWER8 ) if [[ curr_smt_mode -eq 8 ]]; then.
printf("distance from (%.1f%.1f) to (%.1f
We can use strings in printf and scanf with s placeholder printf('' s ''sentence); printf('' 30s ''sentence) The above command writes the string in an area of 30 space length If given length is less than the size of the string so length format is ignored By default the strings are written in right-justified form in the specified area
Primary differences: printf() / scanf() formatter chars – c specifier can match white space characters in the input – white space characters in the control string (t ) which can match
printf("This program copies the source file to the destination file "); printf("Enter name of the source file :"); scanf(" 30s" in_file); printf("Enter name of the destination file :"); scanf(" 30s" out_file); if((fpin=fopen(in_file "r")) == NULL) printf("Error could not open source file for reading ");
Primary differences: printf() / scanf() formatter chars c specifier can match white space characters in the input white space characters in the control string (t ) which can match
We have to go through the following steps: 1) Open a ?le using the library function fopen() which takes an external name such as main c; 2) do some housekeeping work with the sup- port of the operating system; and 3) return a pointer which a program uses to read from or write into this ?le 9
printf: an alternative for echo •The printf command is available in unix and is an alternative for echo •Like echo it is an external command •Synopsis: $ printf “No file name entered ” •Printf uses formatted strings in the same way as C language uses •Here are commonly used formatted string