filename doesn't chagne
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: filename doesn't chagne

  1. #1
    Join Date
    Sep 2012

    filename doesn't chagne

    this is the code:
    #include <stdio.h>
    #include <string>
    #include <iostream>
    using namespace std;
    int main ()
      int result,i,j;
      char oldname[] ="C:\Users\Alex\Desktop\oldname.txt";
     char newname[] ="newname.txt";
      result= rename( oldname , newname );
      if ( result == 0 )
        puts ( "File successfully renamed" );
        perror( "Error renaming file" );
      return 0;
    and it doesn't find it
    it says the the word:"Users" is incorrectly formed universal character name

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003

  3. #3
    Join Date
    Oct 2006

    Re: filename doesn't chagne

    You need to either use a double backslash since a single backslash is the escape character (as shown in the link GCDEF gave you) or you can use a single forward slash (as in *nix) instead.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    and before posting

    Refresh your memory on formatting tags here

    Get your free MS compiler here

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


HTML5 Development Center