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

Thread: filename doesn't chagne

  1. #1
    Join Date
    Sep 2012
    Posts
    6

    filename doesn't chagne

    this is the code:
    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" );
      else
        perror( "Error renaming file" );
      cin.get();
      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
    Posts
    12,053

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    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
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center