file_put_contents()

Posted by sphinx on February 13, 2008.

/* file_put_contents() function in C - PHP Equivalent by sphinx */
int file_put_contents(char *file, char *data) { long long int size; FILE *fp; // later we could improve to have mode 0 or 1, //  as 1 == append if exist, and 0 == rewrite int mode = 0; size = strlen(data); if(mode == 0) { fp = fopen(file,”wb”); if(fp) { fwrite(data, 1, size, fp); } else return 0; } fclose(fp); return 1; }

Bookmark this article!

BlogLinesDel.icio.usDiggFacebookFurlGoogleRedditSlashDotSphinnSpurl

SquidooStumbleUponTechnoratiYahoo

Make a Comment

Make A Comment: ( None so far )

blockquote and a tags work here.

Liked it here?
Why not try sites on the blogroll...

Get a Free Blog @ plinplan.net