Answers for "write in c"

C
14

write in file in c

#include<stdio.h>
int main(){
	FILE *out=fopen("name_of_file.txt","w");
	fputs("Hello File",out);
	fclose(out);
	return 0;
}
Posted by: Guest on April-30-2020
5

how to write function in c

#include <stdio.h>

// Here is a function declaraction
// It is declared as "int", meaning it returns an integer
/*
	Here are the return types you can use:
    	char,
        double,
        float,
        int,
        void(meaning there is no return type)
*/
int MyAge() {
	return 25;
}

// MAIN FUNCTION
int main(void) {
	// CALLING THE FUNCTION WE MADE
    MyAge();
}
Posted by: Guest on April-11-2020
0

write to file in c programming

[...]
  printf("Enter name: \n");
  if (fgets(name, sizeof name, stdin)) {
    fputs(name,fileptr);
    fclose(fileptr);
    printf("File write was successful\n");
  } else {
    printf("Read error.\n");
  }
Posted by: Guest on May-09-2021

Code answers related to "C"

Browse Popular Code Answers by Language