#include<stdio.h>
int main() {
FILE * stream;
stream = fopen("/file.txt", "w");
See AlsoHandle SQL formattingFormat in Python | Format Function in Python - Scaler TopicsFormat SQL Server Dates with FORMAT FunctionConversion Value: What it is, How it Works, Example// Printing a string
char str[20] = "Hello World!";
int x = fprintf(stream, "%s", str);
printf("\n %d characters successfully written to the file\n\n", x);
// Printing an integer value
int age = 22;
x = fprintf(stream, "%d", age);
printf("\n %d characters successfully written to the file\n\n", x);
fclose(stream);
return 0;
}
How to use a printing formatted data to file using fprintf() in C (2024)
Top Articles
Micro vs. Mezzo vs. Macro Social Work | SocialWorkGuide.org
Enfoques contemporáneos en Trabajo Social
Is popcorn a low-carb snack?
Carbs in Hill Country Fare Sugar Free Creamy Peanut Butter
Latest Posts
Computação em Nuvem: O que é, Como funciona e Importância - FIA
10 mejor software de monitoreo de código abierto para infraestructura de TI
Article information
Author: Margart Wisoky
Last Updated:
Views: 5658
Rating: 4.8 / 5 (58 voted)
Reviews: 89% of readers found this page helpful
Author information
Name: Margart Wisoky
Birthday: 1993-05-13
Address: 2113 Abernathy Knoll, New Tamerafurt, CT 66893-2169
Phone: +25815234346805
Job: Central Developer
Hobby: Machining, Pottery, Rafting, Cosplaying, Jogging, Taekwondo, Scouting
Introduction: My name is Margart Wisoky, I am a gorgeous, shiny, successful, beautiful, adventurous, excited, pleasant person who loves writing and wants to share my knowledge and understanding with you.