|
-
November 29th, 2005, 11:36 AM
#1
Questions regarding pointers to files
Suppose I have the entire path name of a file on a network. How would I:
1) obtain a pointer to that file,
and then use that pointer to. . .
2) change the name of the file
and/or
3) open the file using its default application.
The primary task is to open a file containing a scanned document, peruse the file, and rename it according to the contents, (in addition to other tasks involving the file). So, I'd like to create a small application that assists in this. I have potentially hundreds of these file to do each a day.
Thanks for the help.
-
November 29th, 2005, 11:55 AM
#2
Re: Questions regarding pointers to files
The answer to your question depends very much on
- what OS you are using (file handling is done mostly through the OS API)
- what Network are we talking about, i.e. is the file accessed via NFS, FTP, CIFS, ...
In any case, C++ is probably one of the worst choices for such a task. Languages like PERL or Shell/Cmd scripts are typically much more suited, i.e. you will have a working implementation in much quicker time.
-
November 29th, 2005, 12:03 PM
#3
Re: Questions regarding pointers to files
Sadly, I don't know either of those languages. . . :,(
I know next to nothing about networks also. I was hoping there was a simple means of openning, closing and changing names of files on a network drive.
*sigh*
hmmm. . . by OS, I'm assuming you're talking about the computer I'm on. The OS is Windows 2000 professional. Is these an easy way to find out about the network stuff (i.e. FTP, etc.)?
Last edited by paradoxresolved; November 29th, 2005 at 12:07 PM.
-
November 29th, 2005, 12:41 PM
#4
Re: Questions regarding pointers to files
The network protocol you are using can typically told by the way you are accessing the files. If you are accessing them via a UNC name like \\server\service\dir1\dir2\filename, than the protocol is CIFS (formerly called SMB). If you access them via an URL, the protocol is the first part of the URL, e.g. ftp://ftp.codeguru.com/codeexamples/test.cc is using the FTP protocol.
Most likely you are talking about CIFS and should find out the API functions that windows provides for accessing and renaming files.
-
November 29th, 2005, 12:51 PM
#5
Re: Questions regarding pointers to files
Yeah, it appears to match CIFS. . .
I'll start looking for the API functions. Anyone have any ideas where to start?
Thanks for your help, treuss.
Edit: Wow. That is way outside my range of current understanding. Can anyone give me an example of acquiring a pointer to the file in Windows 2000 Professional, via a CIFS network? That would be much appreciated.
Last edited by paradoxresolved; November 29th, 2005 at 12:58 PM.
-
November 30th, 2005, 02:47 AM
#6
Re: Questions regarding pointers to files
You don't need a pointer to run/change name of files, only name of file (with path).
Since there is no (afaik) method to change the name, you have to copy the file to new name (and delete file with old name).
Use CopyFile() or CopyFileEx() to copy the file, and DeleteFile() to delete.
You can run the file with default application by using ShellExecute().
Parameters are described in MSDN.
I hope this helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|