Search
 
SCRIPT & CODE EXAMPLE
 

C

passing FILE as argument in c

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

void my_write(FILE *fp, char *str)
{
    fprintf(fp, "%s", str);
}

int main(void)
{
    char *str = "test text
";
    FILE *fp;

    fp = fopen("test.txt", "a");
    if (fp == NULL)
    {
        printf("Couldn't open file
");
        return 1;
    }
    my_write(fp, str);

    fclose(fp);

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: transfer function exponent matlab 
C :: how to return array of char in c 
C :: convert char number to int in c 
C :: faire une facture en langage c 
C :: pendu langage c 
C :: C program to input the month number and output the month name using switch statement 
C :: pyinstaller hidden import tensorflow not found 
C :: esp8266 wifi.config does not work 
C :: sleep in c 
C :: fread 
C :: c defined 
C :: convert video to gif with ffmpeg 
C :: bool c++ 
C :: passing pointer to function 
C :: node in c 
C :: how to declare a struct in c 
C :: How to send an array through a pipe 
C :: fine print serial key 
C :: c get int inpot 
C :: print in c 11111 00000 11111 00000 11111 
C :: What does x = (a<b)? A:b mean in C programming? 
C :: C static libraries (creating object files) 
C :: Print Characters 
C :: C Change Value of Array elements 
C :: Categorize students according to their marks 
C :: c ausgabe von variablen 
C :: allocate a array on strings in c 
C :: laarvel artisan to create controller model miigration 
C :: user define 
C :: how to declare 3dimensional arrays in wiring 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =