Results 1 to 6 of 6

Thread: Copy any data file from one drive to another using STRING commands

  1. #1
    USMANHEART's Avatar
    USMANHEART is offline Senior Member+
    Last Online
    23rd February 2022 @ 10:00 PM
    Join Date
    18 Aug 2009
    Location
    ISLAMABAD
    Gender
    Male
    Posts
    465
    Threads
    39
    Credits
    1,178
    Thanked
    36

    Default Copy any data file from one drive to another using STRING commands

    Method 1:

    #include<stdio.h>
    #include<stdlib.h>
    #include<conio.h>
    void main()
    {
    FILE *out, *in;
    char ch[25];
    clrscr();
    in=fopen("drive:\\file.ext","r"); /*Any file THAT you wanna copy
    out=fopen("drive:\\file2.ext","w"); /*New file WHERE data will be copy
    while(fgets(ch,25,in)!=NULL)
    {
    printf("%s\n",ch);
    fputs(ch,out);
    }
    fclose(out);
    fclose(in);
    getch();
    }



    METHOD 2:

    #include<stdio.h>
    #include<stdlib.h>
    #include<conio.h>
    void main()
    {
    FILE *out, *in;
    char ch[25];
    clrscr();
    in=fopen("drive:\\file.ext","r"); /*Any file THAT you wanna copy
    out=fopen("drive:\\file2.ext","w"); /*New file WHERE data will be copy
    while(fgets(ch,25,in)!=NULL)
    {
    fputs(ch,out);
    }
    printf("DONE! Press any key to exit.");
    fclose(out);
    fclose(in);
    getch();
    }
    Attached Images Attached Images   
    @ I LOVE ALL @

  2. #2
    USMANHEART's Avatar
    USMANHEART is offline Senior Member+
    Last Online
    23rd February 2022 @ 10:00 PM
    Join Date
    18 Aug 2009
    Location
    ISLAMABAD
    Gender
    Male
    Posts
    465
    Threads
    39
    Credits
    1,178
    Thanked
    36

    Default

    Also try this. It is best!

    METHOD 3:

    #include<stdio.h>
    #include<stdlib.h>
    #include<conio.h>
    void main()
    {
    FILE *out, *in;
    char ch[25];
    clrscr();
    in=fopen("drive:\\file.ext","r"); /*Any file THAT you wanna copy
    if((in=fopen("drive:\\file.ext","r"))==NULL)
    printf("File opening error.");
    else
    printf("DONE! press any key to exit");
    out=fopen("drive:\\file2.ext","w"); /*New file WHERE data will be copy
    while(fgets(ch,25,in)!=NULL)
    {
    fputs(ch,out);
    }

    fclose(out);
    fclose(in);
    getch();
    }
    Attached Images Attached Images  

  3. #3
    iqbal4vu is offline Senior Member+
    Last Online
    5th December 2014 @ 12:30 PM
    Join Date
    06 Aug 2010
    Age
    36
    Gender
    Male
    Posts
    55
    Threads
    28
    Credits
    0
    Thanked: 1

    Default

    Great

  4. #4
    samiullahraj is offline Senior Member+
    Last Online
    20th January 2012 @ 05:44 PM
    Join Date
    08 May 2011
    Gender
    Male
    Posts
    37
    Threads
    11
    Credits
    489
    Thanked: 1

    Thumbs up cmd

    grate

  5. #5
    USMANHEART's Avatar
    USMANHEART is offline Senior Member+
    Last Online
    23rd February 2022 @ 10:00 PM
    Join Date
    18 Aug 2009
    Location
    ISLAMABAD
    Gender
    Male
    Posts
    465
    Threads
    39
    Credits
    1,178
    Thanked
    36

    Default

    Thanx to all

  6. #6
    Join Date
    22 Dec 2010
    Location
    Lakki Marwat
    Gender
    Male
    Posts
    211
    Threads
    5
    Credits
    0
    Thanked
    9

    Default

    wow gr8..........

Similar Threads

  1. Urgent Help Hard drive failure when copy data
    By gentle in forum Ask an Expert
    Replies: 2
    Last Post: 9th June 2015, 08:35 PM
  2. usb drive data copy speed slow how to increase
    By rimjhim in forum Ask an Expert
    Replies: 16
    Last Post: 24th November 2013, 12:34 AM
  3. USB Flash Drive say Jaldi Data copy karin.
    By ammhai in forum General Discussion
    Replies: 84
    Last Post: 7th November 2013, 06:43 AM
  4. Expert Plz Help Flash Drive DATA copy Problem.
    By FerozAli in forum Ask an Expert
    Replies: 4
    Last Post: 18th June 2010, 05:54 PM
  5. help for data copy with long file name
    By usmanatta in forum Ask an Expert
    Replies: 2
    Last Post: 31st July 2008, 06:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •