visual-c++

Viewing dynamically alloocated null-terminated strings with Visual Studio's debugger

回眸只為那壹抹淺笑 提交于 2020-01-21 08:16:46
问题 Is there any way to change the default behavior of Visual Studio's debugger such that when hovering over a null-terminated, dynamically allocated character array (C++), it will display the full content of the string, rather than the first character only? I should mention that I am using Visual Studio 2010. If there is a way to achieve this in VS2012 only though, I would be interested to know that as well! 回答1: There's a useful link for visual studio, C++ Debugger Tips: To interpret a pointer

std::string equivalent for data with null characters?

吃可爱长大的小学妹 提交于 2020-01-21 07:53:45
问题 I'd like to read a binary file and use something like std::string that automatically resizes the buffer and such. I'm using Visual C++. What are my options? 回答1: std::string should be safe to do so... you only have to be careful using .c_str() method. Use .data() . 回答2: The std::string class already does handle data with embedded NUL characters. What problem are you encountering? Note that when using the .c_str() method, any embedded NUL character will terminate the returned C-style string.

CPP + Regular Expression to Validate URL

无人久伴 提交于 2020-01-21 07:25:07
问题 I want to build a regular expression in c++{MFC} which validates the URL. The regular expression must satisfy following conditions. Valid URL:- http://cu-241.dell-tech.co.in/MyWebSite/ISAPIWEBSITE/Denypage.aspx/ http://www.google.com http://www.google.co.in Invalid URL:- http://cu-241.dell-tech.co.in/\MyWebSite/\ISAPIWEBSITE/\Denypage.aspx/ = Regx must check & invalid URL as '\' character between "/\MyWebSite/\ISAPIWEBSITE/\Denypage.aspx/" http://cu-241.dell-tech.co.in//////MyWebSite

Visual C++ 10.0 bug in std::reference_wrapper?

て烟熏妆下的殇ゞ 提交于 2020-01-21 06:20:07
问题 Code: #include <functional> struct Foo { virtual void mf() = 0; }; struct Bar: Foo { virtual void mf() {} }; int main() { Bar o; std::reference_wrapper<Foo const> wrapper( o ); } Result with MinGW g++ 4.6.1: [d:\dev\test] > g++ foo.cpp -std=c++0x [d:\dev\test] > _ Result with Visual C++ 10.0: [d:\dev\test] > cl foo.cpp foo.cpp C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class due to following members: 'void

Exporting a MFC Dialog from a DLL

China☆狼群 提交于 2020-01-21 04:52:07
问题 21st July: Updated, see bottom In VC++ 2005 I have 2 projects. Firstly, a MFC DLL project (not an extension DLL) which has a simple dialog: TestDlg.h #pragma once #include "afxwin.h" #include "resource.h" // CTestDlg dialog namespace Dialogs { class __declspec(dllexport) CTestDlg : public CDialog { DECLARE_DYNAMIC(CTestDlg ) public: CTestDlg (CWnd* pParent = NULL); // standard constructor virtual ~CTestDlg (); // Dialog Data enum { IDD = IDD_TEST_DLG }; } } Then I have a Win32 console app,

Machine dependent _write failures with EINVAL error code

限于喜欢 提交于 2020-01-21 03:43:10
问题 This has some lengthy background before the actual question, however, it bears some explaining to hopefully weed out some red herrings. Our application, developed in Microsoft Visual C++ (2005), uses a 3rd party library (whose source code we luckily happen to have) to export a compressed file used in another 3rd party application. The library is responsible for creating the exported file, managing the data and compression, and generally handling all errors. Recently, we began getting feedback

How can I do a parallel build in Visual Studio 2010?

久未见 提交于 2020-01-20 12:58:47
问题 How can I get VS 2010 to run more than one C++ compile process at a time? I mean building object modules in parallel; I'm not interested in building more than one project at a time (I know about Tools > Options > Build and Run < Maximum number of parallel project builds, but that doesn't do what I want). Basically, I'm looking for Visual Studio's equivalent of "make -jN". 回答1: Tools -> Options Projects and Solutions\VC++ Project Settings Maximum concurrent C++ compilations Also, as Ross Smith

How can I do a parallel build in Visual Studio 2010?

不问归期 提交于 2020-01-20 12:55:57
问题 How can I get VS 2010 to run more than one C++ compile process at a time? I mean building object modules in parallel; I'm not interested in building more than one project at a time (I know about Tools > Options > Build and Run < Maximum number of parallel project builds, but that doesn't do what I want). Basically, I'm looking for Visual Studio's equivalent of "make -jN". 回答1: Tools -> Options Projects and Solutions\VC++ Project Settings Maximum concurrent C++ compilations Also, as Ross Smith

How can I do a parallel build in Visual Studio 2010?

此生再无相见时 提交于 2020-01-20 12:54:06
问题 How can I get VS 2010 to run more than one C++ compile process at a time? I mean building object modules in parallel; I'm not interested in building more than one project at a time (I know about Tools > Options > Build and Run < Maximum number of parallel project builds, but that doesn't do what I want). Basically, I'm looking for Visual Studio's equivalent of "make -jN". 回答1: Tools -> Options Projects and Solutions\VC++ Project Settings Maximum concurrent C++ compilations Also, as Ross Smith

Using overlapped IO for console input?

独自空忆成欢 提交于 2020-01-20 05:03:45
问题 I'm attempting to use overlapped IO to read input from the console by opening CONIN$ with the FILE_FLAG_OVERLAPPED flag. However, ReadFile blocks when I use it, even with an OVERLAPPED parameter. I've read some posts reporting that this is a Windows 7 bug. I am using 7 so that could be possible. Here's the code I'm using: // Create a console window AllocConsole(); AttachConsole(GetProcessId(GetModuleHandle(NULL))); HANDLE overlappedConsoleIn = CreateFile(L"CONIN$", GENERIC_READ, FILE_SHARE