Are there any functions that when given an error number returned from WSAGetLastError() and GetLastError() will return a char * to a descriptive string for that error. I am using unmanaged C++. This is what I would like to be able to do: cout << strerror(WSAGetLastError()) << endl; -- modified at 16:57 Monday 11th June, 2007
maizhiming
Posts
-
strerror() for WSAGetLastError() and GetLastError() [modified] -
converting from const char [] to 'LPWSTR'When I compile this code in MSVC++ 2005 express I get the following error. SERVICE_TABLE_ENTRY DispatchTable[]= {{"Service1",serviceMain},{NULL,NULL}}; error C2440: 'initializing' : cannot convert from 'const char [9]' to 'LPWSTR' Pretty much where ever I am using a string I get the same error. Why doesn't the code work?
-
Access Denied error [modified]Here is the code that I am using. I am referencing the file in the last sub-routine "Save_Click".
Sub SaveNodes(ByVal nodesCollection As TreeNodeCollection, ByVal textWriter As System.Xml.XmlTextWriter)
Dim link_node As TreeNode
For Each link_node In nodesCollection
If link_node.ChildNodes.Count Then
textWriter.WriteStartElement("Folder")
textWriter.WriteAttributeString("Name", link_node.Text)
textWriter.WriteRaw(vbCrLf)
Else
textWriter.WriteStartElement("Link")
textWriter.WriteAttributeString("Name", link_node.Text)
textWriter.WriteAttributeString("Location", link_node.NavigateUrl)
End IfIf link\_node.ChildNodes.Count > 0 Then SaveNodes(link\_node.ChildNodes, textWriter) End If textWriter.WriteEndElement() textWriter.WriteRaw(vbCrLf) Next
End Sub
Sub SaveTreeViewData(ByVal treeView As TreeView, ByVal path As String)
'Create a serializer and file to save TreeViewData
Dim TextWriter As New System.Xml.XmlTextWriter(path, System.Text.Encoding.UTF8)TextWriter.WriteStartDocument() TextWriter.WriteRaw(vbCrLf) SaveNodes(treeView.Nodes, TextWriter) TextWriter.Close()
End Sub
Protected Sub Save_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Save.Click
SaveTreeViewData(Link_Tree, "favorites.xml")
End Sub -
Access Denied error [modified]I am relatively new to ASP.NET and have just uploaded my first page. I have a "Save" function that writes information from a control to an XML file. Whenever I try to run this function I get this error from ASP.NET: Server Error in '/' Application. -------------------------------------------------------------------------------- Access to the path 'c:\windows\system32\inetsrv\favorites.xml' is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access to the path 'c:\windows\system32\inetsrv\favorites.xml' is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access. -------------------------------------------------------------------------------------- I'm not sure how to change the access rights because I am using a web hosting service. It works fine on my local machine. What should I do from here?
-
TreeView SelectedNodeChanged [modified]That was the problem. Thanks for the tip.
-
TreeView SelectedNodeChanged [modified]I have a regular ASP.NET TreeView control on my page that is auto populated from an XML file using DataBindings. In the SelectedNodeChanged event handler routine, I have it make the text of the selected (clicked) node bold. My problem is: It doesn't matter which node I click on, it always bolds the top most node in that level of the tree. It never bolds the node I selected unless it is the top most node of a level. It appears as if the page is doing a postback to the server (as it should). But I am not sure if that is the issue. How do I make it so that the node I click on stays "clicked". Here is what I am talking about: If this is my tree (below) and I click on "VBScript" it bolds "XML" when it should actually bold "VBScript".
Main
XML
XHTML
Visual C++
Visual Basic
VBScript
UMLPS. Is there a way to implement a control-click event for the TreeView control? -- modified at 18:59 Wednesday 21st June, 2006
-
Advantages of MFCI am an avid Visual Basic programmer and I would like to know what the advantages of using Visual C++/MFC are over Visual Basic. For what kinds of scenarios can you not use Visual Basic?