Thread: File

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    29

    File

    Hi!

    How can i put a file into a paste and then read it again from that paste.

    // mkdir("PASTE");

    char string[] = "MONKEY";
    File *fp;
    fp = fopen("dates.dat", "w");
    fprintf(fp, "%s\n", string);
    fclose(fp);

    I have created the file and the paste, and i want to copy that file to the created paste.

    thanks

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    What?
    do you mean the clipboard?
    I think im too tired.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    29
    The file is dates.txt or can be something else.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you want to move a file, use the rename() function
    http://www.gnu.org/software/libc/man...naming%20Files

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    84
    in windows you should use:
    Code:
    #include <windows.h>
    
    CreateDirectory("PASTE", NULL);
    SetCurrentDirectory("PASTE");
    ...fopen...fwrite...fclose
    And of course moving and renaming file is done by MoveFile(...) in windows.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM