Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define L 30
- FILE *Aprifile (void);
- int vocali (char s[L]);
- int iniziale (char s[L]);
- /*
- *
- */
- int main(int argc, char** argv) {
- FILE *t;
- t=Aprifile();
- while (feof(t)) {
- }
- return (EXIT_SUCCESS);
- }
- FILE *Aprifile (void) {
- char nomefile[L];
- char c[L];
- FILE *t;
- int i=0;
- printf("Inserire il nome del file da aprire:\n");
- while ((nomefile[i]=getchar())!= '\n') {
- i++;
- }
- nomefile[i]='\0';
- printf("Specificare la modalità di apertura del file:\n");
- for(i=0;(c[i]=getchar())!= '\n';i++) {
- }
- c[i]='\0';
- t = fopen(nomefile,c);
- if(t==NULL) {
- printf("Errore apertura file");
- return EXIT_FAILURE;
- }
- return t;
- }
- int vocali (char s[L]) {
- int i=0,k=0,num=0;
- char voc[10]={'A','a','E','e','I','i','O','o','U','u'};
- while (s[i]!='\0') {
- for(k=0;k<10;k++) {
- if (s[i] == voc[k]) {
- num++;
- }
- i++;
- }
- }
- return i;
- }
- int iniziale (char s[L]) {
- if (s[0]>='A'&& s[0]<='Z' )
- return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement