CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 32

Threaded View

  1. #31
    Join Date
    Apr 1999

    Re: CreateFile Failed problem

    Quote Originally Posted by wklove2003 View Post
    Here is where the declaration is. So 16 characters.
    #ifdef __APPLE_CC__
      char mDevice[64];
      char mDevice[16];
    What if the name is more than 16 characters? How are you going to stuff 10 pounds of potatos into a 5 pound bag?
     strncpy(mDevice, aDevice, sizeof(mDevice) - 1);
    This effectively truncates that name to 15 characters.
    CreateFile on \\.\C:\Documents an=failed with error code: 2"
    That is the message you got back. Look at the name -- it should be much more than 15 characters. How much more? That's what string classes such as CString and std::string are for -- unlimited length strings.


    Paul McKenzie
    Last edited by Paul McKenzie; September 13th, 2010 at 02:38 PM.

Tags for this Thread

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

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.