Thread: Dealing with windows files

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    104

    Post Dealing with windows files

    I looked aroud but never saw any tutorial on how to deal with file in windows, Such as renaming a file. My current project involves using a program to extract some info (the title field) from a pdf document, and rename the pdf file using the title as its new name. Let's start easy, how can I rename a file with a string after its opened?

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Dealing with "Windows file" in the sense of renaming them, would be a Windows specific function. On that note, I'd probably say your best research would be MSDN.
    Sent from my iPadŽ

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Search your C++ reference for the rename function. The standard library provides the feature you're looking for.
    My best code is written with the delete key.

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Seriously? Well you learn something new everyday...
    ...in my case... every couple of minutes. I knows how to tie my shoos now!

    Edit: Infact, I could swear I already knew about the rename function and if you check my post history, I at some point suggested and explained it to someone. Something I'm doing clearly isn't good for my memory.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Oct 2003
    Posts
    104
    Quote Originally Posted by SlyMaelstrom
    Seriously? Well you learn something new everyday...
    ...in my case... every couple of minutes. I knows how to tie my shoos now!

    Edit: Infact, I could swear I already knew about the rename function and if you check my post history, I at some point suggested and explained it to someone. Something I'm doing clearly isn't good for my memory.
    tried searching, but only this post came up.
    http://cboard.cprogramming.com/searc...earchid=519988

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >tried searching, but only this post came up.
    *sigh*
    http://www.dinkumware.com/manuals/?m...io.html#rename
    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Oct 2003
    Posts
    104
    Quote Originally Posted by Prelude
    >tried searching, but only this post came up.
    *sigh*
    http://www.dinkumware.com/manuals/?m...io.html#rename
    In reference to my searched, I was talking about SlyMaelstrom 'previous' post on the subject, as the link said. It is interesting that this is so difficult to find. I didn't find it under the Windows API forum, nor under the sticky links at http://www.winprog.org/tutorial/ , http://www.functionx.com/win32/index.htm or http://msdn.microsoft.com/library/de..._reference.asp and i searched them all.

    Only the msdn had anything close to rename the file and this was to copy the file and delete the old one. all the other search results dealt with complex windows API commands which seemed too much for such a simple problem. I still have to check to see if I could do that in C++.
    Last edited by Hexxx; 08-17-2006 at 12:55 PM.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I still have to check to see if I could do that in C++.
    Maybe I'm misunderstanding you, but rename is a C++ function. Guaranteed to do what you're asking by the C++ standard. Every compiler supports it and it's trivial to use. Your search is over.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows Vista Batch Files
    By Trennto in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2008, 09:30 AM
  2. Read/Write .WAV files in Windows?
    By thetinman in forum C++ Programming
    Replies: 3
    Last Post: 03-05-2006, 05:07 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. windows header files not linking correctly
    By skorman00 in forum Windows Programming
    Replies: 2
    Last Post: 04-13-2005, 11:14 AM
  5. Dos commands hehe
    By Carp in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-17-2003, 02:51 PM