Thread: How to save data to a file using FILES in C

  1. #1
    Registered User
    Join Date
    Mar 2009

    How to save data to a file using FILES in C

    How to save data to a file using FILES in C???

    pls show me some formats...

  2. #2
    "I Win!" by U. Lose vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    To be or not to be == true

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    #include <stdio.h>
    #include <fcntl.h>
    #include <string.h>
    typedef int FLIES;
    int main (int argc, char *argv[]) {
    	char content[]="data";
    	FLIES away=open(argv[1],O_WRONLY | O_CREAT), x=1;
    	if (!(argv[1])) { puts("You didn't specify a filename."); return -1; }
    	if (write(away,content,strlen(content))<3) perror("write");
    	return 0;
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 04-15-2009, 10:35 AM
  2. ordered linked list
    By redmondtab in forum C Programming
    Replies: 48
    Last Post: 10-22-2006, 06:09 AM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. archive format
    By Nor in forum A Brief History of
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM