|
Message Closed
modified 19-May-23 21:26pm.
|
|
|
|
|
polcott wrote: If I was actually wrong someone could point out a mistake.
I can't speak for anyone else but I am certainly not going to attempt to teach you an entire class on Turing Machine mathematics.
And I already suggested that you take exactly that sort of class.
I found one that teaches it. I know there are others.
Models of Computation[^]
|
|
|
|
|
Latest update: the bug is gone after I run cmd console, instead of the new Terminal console. Case closed. Thanks everybody for checking and testing.
I found a cout bug with Visual C++ 2022 on Windows 11. VC++ 2019 does not have this bug. When I try to debug, the problem goes away. I have produced a small repo that reproduces the issue. Please help me check so that I can report this bug to Microsoft. Thanks.
modified 12-May-23 8:10am.
|
|
|
|
|
I cannot confirm the bug. Everything works in the order expected.
Microsoft (R) C/C++ Optimizing Compiler Version 19.35.32217.1 for x86
on
Windows 11 Pro
Version 22H2 (OS Build 22621.1555)
|
|
|
|
|
Thanks. Your Visual C++ and Windows edition is the same as mine. Did you run it a few times? The bug has 50% chance of reproducing when run normally (meaning not debugging).
|
|
|
|
|
Only about 30 times, and it never happened even once.
|
|
|
|
|
The bug is gone after I followed Richard's suggestion to run the old cmd console. Thanks for testing.
|
|
|
|
|
I was using CMD Prompt and Powershell in Terminal with no issues at all, in both Debug and Release builds.
|
|
|
|
|
It looks like nobody is encountering this issue except me. Thanks again. You can stop testing.
|
|
|
|
|
Its working fine here on Windows 10, VS 17.5.5, so I would suspect the Windows 11 terminal - can you try running it in a cmd.exe window instead?
|
|
|
|
|
My c:\windows\system32\cmd.exe is already the new Windows 11 terminal. I am not sure where the old cmd.exe is.
|
|
|
|
|
If the Terminal in Windows 11 is the same as the one in 10 then you can configure it to run cmd, Powershell, Linux shell etc.
|
|
|
|
|
Thanks for your suggestion. I have configured it to run the normal cmd window by right-clicking the tab area and choosing "Settings" in the pop-up menu and selecting accordingly. The bug is gone.
|
|
|
|
|
Very interesting. What program was it running before your change?
|
|
|
|
|
Before my change to the old normal cmd, the new Terminal console has a tabbed interface and was slower than cmd window. I did not change my code. Now it is running fine.
|
|
|
|
|
Mine also has a tabbed interface, so I have three tabs: cmd , PowerShell and Linux under WSL. It seems just as fast as anything else. I can only assume there is another interface that is the default in the 11 version. Unfortunately (or maybe not) my PC does not support Windows 11.
|
|
|
|
|
Richard MacCutchan wrote: Terminal in Windows
I am not familiar with that. Presumably it is the following which one must install specifically, at least in Windows 10?
An overview on Windows Terminal | Microsoft Learn[^]
So you use that normally? I am curious why do you consider that ideal rather than going directly to either cmd or a linux shell?
|
|
|
|
|
jschell wrote: why do you consider that ideal rather than going directly to either cmd or a linux shell? I did not claim it is ideal, it is just another tool that I find useful at times. I run cmd, Powershell and Linux in "normal" windows also.
|
|
|
|
|
Using the cmd.exe window, the bug is gone.
|
|
|
|
|
I am trying to play an mp3 file from a WinAPI/C++ application. I'm using 32-bit MinGW on Windows 10.
I found an example program which uses the MCI (winmm) interface to play the file; I found an example command-line program which implements this using mciSendString() calls...
I had some problems handling paths to the mp3 file, and *thought* I had fixed it by converting the paths to 8.3 short format... the command-line program plays the files just fine, but when I import exactly the same code into my WinAPI dialog-box application, although the MCI functions all return success, no sound plays...
Does anyone have any idea what is missing here?? Or does this library just not work from a Windows dialog app?
Here's the code:
{
static char short_str[MAX_WAVE_FILE_LEN+1] = "" ;
CMP3_MCI MyMP3;
int result = GetShortPathName (wave_name, short_str, MAX_WAVE_FILE_LEN);
syslog("short: %d: [%s]\n", result, short_str);
DWORD lerror = MyMP3.Load(short_str);
DWORD serror = MyMP3.Play();
syslog("MCI: Load: %08X, Play: %08X\n", lerror, serror);
}
And here are the load and play functions from his MCI class:
inline MCIERROR Load()
{
std::string szCommand = "open \"" + GetFileName() + "\" type mpegvideo alias " + GetFileName();
return mciSendString(szCommand.c_str(), NULL, 0, 0);
}
inline MCIERROR Load(char *szFileName)
{
m_szFileName = szFileName;
return Load();
}
inline MCIERROR Play()
{
std::string szCommand = "play " + GetFileName() + " from 0";
return mciSendString(szCommand.c_str(), NULL, 0, 0);
}
|
|
|
|
|
This is a Simple C++ DirectShow MP3 Player Class for native C++ and .NET.
This is an example on how to use the Mp3 class.
<h1>include "Mp3.h"</h1>
void main()
{
::CoInitialize(NULL);
std::wcout<<L"Enter the MP3 path: ";
std::wstring path;
getline(wcin, path);
std::wcout<<path<<std::endl;
Mp3 mp3;
int status = 0;
if(mp3.Load(path.c_str()))
{
status = SV_LOADED;
}
else {
}
if(mp3.Play())
{
status = SV_PLAYING;
}
else {
}
if(mp3.Stop())
{
status = SV_STOPPED;
}
else {
}
::CoUninitialize();
}
modified 12-May-23 8:19am.
|
|
|
|
|
Well, all of the Windows-supported libraries present problems, especially if one is building using MinGW rather than Visual C++. Generally, they cannot be built at all without a massive amount of hacking the code bases to make them MinGW-compatible. No DirectShow apps will build, neither will the more-recent MS audio interface (don't recall the name at the moment).
However, I found a freeware library called zplay, which is easy to build, open source, and nice, compact code... it also has the ability to play other formats, such as flac... so I'll just go with that...
libZPlay multimedia library (Win32)[^]
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
Member 14968771 wrote: Here is definition of function taken from an example:
void SettingsDialog::pairingDone(QBluetoothAddress ,QBluetoothLocalDevice::Pairing)
I need to verify the actual address and having a tough time understanding this "syntax".
I do understand that the function parameters are "objects" but when I RTFM it really does not explain the syntax. All I get is "passing by value or by reference" - so what are the parameters actually passed to "pairingDone" ?
If possible
please show me how to get the address - post actual C code
point me to good resource to learn something about the syntax
recommend a C++ book so I can retire my "K&R" book
I can do without opinions and innuendos insults or RTFM replies.
Keep Calm and Carry On
modified 10-May-23 15:25pm.
|
|
|
|
|
You should have Stroustrups's "The C++ Programming Language", which is the C++ equivalent of K&R for C. https://www.amazon.com/C-Programming-Language-4th/dp/0321563840 It's not cheap, but its the bible of C++. Stroustrup invented it after all.
I lost my copy of K&R a long time ago. My version was pre-ANSI, which meant that there was no void , and no function prototypes, among other things, and function definitions looked like
foo(x, y)
int x;
int y;
{
} I'd be willing to bet even K&R that old explained the difference between "pass by value" and "pass by reference" i.e the difference between making a copy of an object and passing that to the function (pass by value, possibly expensive), and passing a pointer to a an object (pass by reference, usually cheap. But at least in C may lead to off-by-one and other assorted bugs. NB. An array is always passed by reference.). In C++ we have references . [Reference declaration - cppreference.com]
(https://en.cppreference.com/w/cpp/language/reference)
Keep Calm and Carry On
|
|
|
|