Tab Content
No Recent Activity

1 Visitor Messages

  1. Try something like this?
    1.
    #include <stdio.h>
    2.
    #include <stdlib.h>
    3.

    4.
    int main (void)
    5.
    {
    6.
    size_t len = 0 ;
    7.
    const char a[] = "c:/a/a.exe" ;
    8.
    const char b[] = "d:/b/b.exe" ;
    9.
    char buffer[BUFSIZ] = { '\0' } ;
    10.

    11.
    FILE* in = fopen( a, "rb" ) ;
    12.
    FILE* out = fopen( b, "wb" ) ;
    13.

    14.
    if( in == NULL || out == NULL )
    15.
    {
    16.
    perror( "An error occured while opening files!!!" ) ;
    17.
    in = out = 0 ;
    18.
    }
    19.
    else // add this else clause
    20.
    {
    21.
    while( (len = fread( buffer, BUFSIZ, 1, in)) > 0 )
    22.
    {
    23.
    fwrite( buffer, BUFSIZ, 1, out ) ;
    24.
    }
    25.

    26.
    fclose(in) ;
    27.
    fclose(out) ;
    28.

    29.
    if( remove(a) )
    30.
    {
    31.
    printf( "File successfully moved. Thank you for using this mini app" ) ;
    32.
    }
    33.
    else
    34.
    {
    35.
    printf( "An error occured while moving the file!!!" ) ;
    36.
    }
    37.
    }
    38.

    39.
    return 0 ;
    40.
    }
Showing Visitor Messages 1 to 1 of 1
About Ziexxx

Basic Information

About Ziexxx
What are you here for?:
Gaming Fun
Gender:
male

Statistics


Total Posts
Total Posts
0
Posts Per Day
0
Visitor Messages
Total Messages
1
Most Recent Message
01-04-2009
Total Thanks
Total Thanks
0
  • Thanked 0 Times in 0 Posts
General Information
Last Activity
05-27-2010
Join Date
12-01-2008
Referrals
0
Post Areas

Top Areas Of Posting