visual-c++-2010

How do i get the screen to pause? [duplicate]

不想你离开。 提交于 2019-12-19 05:10:07
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: How to stop C++ console application from exiting immediately? So im learning c++ and i was given this example and i wanted to run it. But i cannot get it to stay up, unless i change it. How do i get Microsoft visual 2010 to keep up the screen when it gets to the end of the program after I release it? #include<iostream> using namespace std; int area(int length, int width); /* function declaration */ /* MAIN

How to get string with pattern from std::regex in VC++ 2010

最后都变了- 提交于 2019-12-18 07:36:11
问题 Can I get the string with regular expression from std::regex ? Or should I save it somewhere else if I want to use it later? In boost you can do this: boost::regex reg("pattern"); string p = reg.str(); or use << operator cout << reg; will print pattern . but in std::regex there is no str() or operator<<. Should I save my string somewhere else or I just can't find it? In debugger I can see what's in std::regex . 回答1: I just looked in N3225, section 28.4 (header <regex> synopsis) and indeed,

printf 64bit type specifier issue

空扰寡人 提交于 2019-12-14 01:24:25
问题 I'm seeing some strange behaviour with __int64 types with msdev 2010. Could anyone enlighten me as to what is going on ? I guess there are 2 issues here, firstly how to display 64bit ints, secondly the behaviour - i.e. why is it looking like __int64 is actually a 32bit int... #include <stdio.h> int main() { int vl_idx; unsigned __int64 vl_64; unsigned __int64 vl_64_test; for (vl_idx = 0; vl_idx < 64; vl_idx++) { vl_64 = 1 << vl_idx; printf ("vl_64 (%d) = %I64u\n", vl_idx, vl_64); printf ("vl

How to use templates with C++/CLI 2010?

血红的双手。 提交于 2019-12-13 07:37:49
问题 I've got following method in c#: public static T[] GetResult<T>(ulong taskId) { return GetResult(taskId).Cast<T>().ToArray(); } and I'm trying to use it in managed c++ 2010 like this: array<UrlInfo^>^ arr=Scheduler::GetResult<UrlInfo>(taskId); where I'm getting Error 3 error C2770: invalid explicit generic argument(s) for 'cli::array<Type,dimension> what am I doing wrong? 回答1: If UrlInfo is a value type, you don't want the ^ . Try array<UrlInfo>^ arr If UrlInfo is a reference type, you need a

C++ Visual Studio 2010, compile error C3867 when implementing dynamic stack

落爺英雄遲暮 提交于 2019-12-13 05:35:40
问题 Currently working on an assignment for my datastructures class in university using stacks with dynamic memory allocation. Currently I'm getting a compile error C3867 saying I'm missing a function call from an argument list. I'm not really understanding where this error is coming from / I'm having trouble identifying what exactly is my error in my code; so I was wondering if someone might be kind enough to explain to me what it is, and maybe a friendly tip to remember so I can not have this

Issue with Pointers (Only in Release Build)

守給你的承諾、 提交于 2019-12-12 15:14:48
问题 unsure how to go about describing this but here i go: For some reason, when trying to create a release build version of my game to test, the enemy creation aspect of it isn't working. Enemies *e_level1[3]; e_level1[0] = &Enemies(sdlLib, 500, 2, 3, 128, -250, 32, 32, 0, 1); e_level1[1] = &Enemies(sdlLib, 500, 2, 3, 128, -325, 32, 32, 3, 1); e_level1[2] = &Enemies(sdlLib, 500, 2, 3, 128, -550, 32, 32, 1, 1); Thats how i'm creating my enemies. Works fine when in the debug configuration but when

C++ MultiThreading with visual studio express 2010 Forms Application

南楼画角 提交于 2019-12-12 10:48:22
问题 I am developing a Windows forms application which connects to a piece of hardware, acquires a lot of data (~1 GSample/sec), processes it, and spits it out to the screen upon a button click. I am now trying to automate the process in a loop that can be started/stopped at any time so I can monitor it whilst tweaking the input to the acquisition hardware. I thinks it's clear that I need to do this on a separate thread, but I'm having a heck of a time trying to do this in c++/cli - I have found a

How can I get an intrinsic for the exp() function in x64 code?

纵然是瞬间 提交于 2019-12-12 08:29:44
问题 I have the following code and am expecting the intrinsic version of the exp() function to be used. Unfortunately, it is not in an x64 build, making it slower than a similar Win32 (i.e., 32-bit build): #include "stdafx.h" #include <cmath> #include <intrin.h> #include <iostream> int main() { const int NUM_ITERATIONS=10000000; double expNum=0.00001; double result=0.0; for (double i=0;i<NUM_ITERATIONS;++i) { result+=exp(expNum); // <-- The code of interest is here expNum+=0.00001; } // To prevent

Did Intellisense quality and stability get improved in MSVC++ 2010?

≡放荡痞女 提交于 2019-12-11 16:34:02
问题 Two separate questions really, for those of you who have upgraded from 2008 to 2010: Does intellisense work much better in this version in terms of completeness? Does it still suffer from corrupted NCB files and other performance/stability issues? 回答1: The IntelliSense parser was completely rewritten for VS2010. The .ncb file is history. It's now a .sdf file, a SQL Server Compact dbase. It works very well on my machine, I have seen very few complaints about it. Notable is that the C++/CLI

My StartDoc() fails in Windows 7, runs well in Windows XP

风格不统一 提交于 2019-12-11 11:22:33
问题 My code is in 32 bit Visual C++ 2010. It is the usual print-using-default-printer one, which goes like this (this is the exact code minus error handlers): // Get the length of the printer name. GetDefaultPrinter(NULL, &size); lpcPrinterName = new char[size]; // Get the printer name. if(!GetDefaultPrinter(lpcPrinterName, &size)) { // handle error return false; } // Get a device context for the printer. hdcPrint = CreateDC(NULL, lpcPrinterName, NULL, NULL); // get printer parameters