msvcrt

How to get a handle on Windows STDOUT handles (in python)?

不羁的心 提交于 2019-12-18 09:46:53
问题 I am trying to get a handle on Windows stdout handles. I need to understand why there are different handles for STDOUT ( CONOUT$ ?) and how to interpret these differences. I know there are different output buffers used by the Windows API, but failt to understand (from the many MSDN docs) when and how to, use them. Using ctypes and python3, I can get 2 of these by the script below. However, running the script in (Cygwin) mintty/bash , PowerShell (6.1.1), CMD or even ConEmu , all yield slightly

timegm cross platform

て烟熏妆下的殇ゞ 提交于 2019-12-17 19:58:05
问题 I'm using Visual Studio c++ Compiler ( 2010 ), but the library has different implementation of ANSI C and POSIX libraries function. What is the difference between ANSI C function and Windows CRT implementation? For example what is the difference between tzset() and _tzset() or setenv() ans _setenv() ? It seems the do the same thing in the same way... I'm using msvc ( 2010 ), have I to prefer the Windows CRT Implementation? EDIT 1 Well I want convert in a portable way a struct tm expressed in

Python Windows `msvcrt.getch()` only detects every 3rd keypress?

独自空忆成欢 提交于 2019-12-17 19:25:14
问题 My code is below: import msvcrt while True: if msvcrt.getch() == 'q': print "Q was pressed" elif msvcrt.getch() == 'x': sys.exit() else: print "Key Pressed:" + str(msvcrt.getch() This code is based on this question; I was using it to acquaint myself with getch . I've noticed that it takes 3 pressing the key 3 times to output the text once. Why is this? I'm trying to use it as an event loop, and that's too much of a lag... Even if I type 3 different keys, it only outputs the 3rd keypress. How

Visual studio 2015 run-time dependencies or how to get rid of Universal CRT?

自作多情 提交于 2019-12-17 10:37:28
问题 Compiled couple of .dll's using visual studio 2015, and tried to deploy on some older windows 7 / 64 bit. Tried also to guess which dll's are needed for application to start and copied MSVCP140.DLL & VCRUNTIME140.DLL - but application could not load vs2015 dll. Started to analyze what is wrong - and dependency walker showed dependencies from following dll's: API-MS-WIN-CRT-MATH-L1-1-0.DLL API-MS-WIN-CRT-HEAP-L1-1-0.DLL API-MS-WIN-CRT-CONVERT-L1-1-0.DLL API-MS-WIN-CRT-STRING-L1-1-0.DLL API-MS

Should I link to the Visual Studio C runtime statically or dynamically?

给你一囗甜甜゛ 提交于 2019-12-17 08:32:19
问题 I have read arguments on both sides about whether one should link to the C runtime library statically or dynamically in Visual Studio projects, and I'm still not entirely sure what to think. My project pulls in some third-party libraries (Python, HDF5, Trilinos, and Microsoft MPI), each of which has to be built with the same runtime library as my final executable (otherwise they cannot be linked together). When linking statically, each of these libraries will contain a copy of the C runtime.

Should I link to the Visual Studio C runtime statically or dynamically?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 08:30:57
问题 I have read arguments on both sides about whether one should link to the C runtime library statically or dynamically in Visual Studio projects, and I'm still not entirely sure what to think. My project pulls in some third-party libraries (Python, HDF5, Trilinos, and Microsoft MPI), each of which has to be built with the same runtime library as my final executable (otherwise they cannot be linked together). When linking statically, each of these libraries will contain a copy of the C runtime.

Does msvcrt.dll use a linear congruential generator for its rand() function?

北战南征 提交于 2019-12-13 06:30:48
问题 I am trying to predict the output of a program that uses msvcrt's rand() function for generating the face of three dice. I believe the code is something like: dice[0] = rand() % 6 + 1; dice[1] = rand() % 6 + 1; dice[2] = rand() % 6 + 1; , and I was wondering if I could use a prediction program for linear congruential generators to predict the next numbers in the sequence. 回答1: See for yourself: C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\rand.c (Or use %VCINSTALLDIR%\crt\src\rand.c

Can I use MSVCRT functions in my DLL Delay-Load Handler function?

霸气de小男生 提交于 2019-12-13 05:27:14
问题 I have already added delay loading to my project, using the instructions in http://msdn.microsoft.com/en-us/library/151kt790.aspx In the "delayhlp.cpp" (a sample implementation of the DLL load helper) __HrLoadAllImportsForDll , I saw that the writer avoids using any Standard C Library (MSVCRT) functions. Do I need to do the same in my handler function, which will be called by the sample DLL load helper? I think the writer's reason is that someone might try to delay-load MSVCRT itself. I'm not

How would I implement if a key is held down?

邮差的信 提交于 2019-12-13 03:49:46
问题 I've searched a lot of threads about this issue but none seem to meet my needs. I'm intending on implementing this code into a script that uses the terminal for use, so using something like pygame is really awkward. I'm doing this for personal use, so any Windows OS dependent solutions would work. Essentially, I want Python to make the variable keyState equal to LOW if a key is pressed/held and HIGH as long as it's not being pressed. I've tried using mscvrt but it hasn't worked. I would think

Build MinGW Console application without CRT?

时光总嘲笑我的痴心妄想 提交于 2019-12-13 01:56:06
问题 I can build apps with MSVC without the CRT as directed here: http://www.mvps.org/user32/nocrt.html But how can this be done with MinGW? It seems to always pull in the CRT (msvcrt.dll) by default. Edit: To be clear I'm trying to NOT link the CRT at ALL, not statically link it which I know isn't possible due to copyright issues. 来源: https://stackoverflow.com/questions/23218931/build-mingw-console-application-without-crt