troubleshooting Question

UNC paths, using CreateFile(): Able to obtain a FILE pointer?

Avatar of gunn
gunn asked on
Microsoft Development
7 Comments1 Solution1165 ViewsLast Modified:
We have some C code that runs on multiple platforms (VMS, UNIX,Windows) and need the capability in Windows to be able to open files specifed as a UNC path. All the MSDN help I read points me to using CreateFile(). That's fine. However, its not too bad to replace all the fopen()'s in the code currently with

#ifdef WIN32
 CreateFile(...)
#else
 fopen(...)
#endif

but the rest of the code uses the return from fopen(), the FILE pointer for accessing the file. I'd *really* rather now take on the job of replacing this code that is everywhere with that. Soooooo, I was wondering...is there a way to take the returned HANDLE from CreateFile() and turn it into a FILE pointer somehow, so I can use the other functions to access it?
Thanks,
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros