Not really, it's pretty basic stuff. As I said before, you cannot send a pointer to an array of integers to a function that expects a pointer to an array of doubles. The types are totally different so your program would just be processing garbage. I showed you in my previous message how to pass the array of integers to the function that needs the values as doubles. That is all there is to it, the compiler will generate the correct code to convert each integer to a double as you process them. The resulting double values can then be used in your FFT calculations.
one collecting 10 bits of data into 16 bits integer array
This is common for transferring along byte boundaries. If you transmit 10bits, how many bytes are you moving across a network? ...yeah, integer numbers are desirable for network operations. Pretty much all receivers/digitizers do this.
if I cast or build a new variable as double it will take an 16 bit integer and
process it as double, than what will happen to the original array ?
When casting, nothing happens to your original data, a copy is made. Although as Richard already mentioned, you can't simply cast a whole array, since your element spacing will be different (16bit vs 32bit array elements).
I am still learning about FFT , but as far as I can tell the first FFT function
puts new data (normal pointer behavior) into the original (integer )
array as what ? Integer?
Output of most FFT routines is a float or double (depending on whether it's "single" or "double" precision math).
I think the only way is to collect the ADC data into double array
from get go.
Not going to happen. Analog to digital converters (and most hardware for that matter) deal with integers (you'll commonly hear the term fixed point math, that's why).
Thanks for reply. Somehow I did not get the message across and the main question is getting muddled by stuff I am not so concerned about. The bottom line - which I actually just wanted someone to confirm - is that casting pointers from integer to double is a stupid idea. Thanks Case closed
You can use the wide char versions of atof()[^] or strtod()[^]. If the string does not begin with the numeric value (spaces are ignored), you must parse the string and pass a pointer to the value's offset.
Signed integers seem to be a minefield of undefined behaviour lurking around every corner. You can't even add them without potentially blowing up the Death Star, unless you test for potential overflow first.
Should they be avoided? How should this be dealt with? How bad is it to pretend it's not a problem?
But there's a well-known (and infamous) optimization that GCC does where if on some code path a signed integer would overflow, it deduces that therefore that code path must be dead. In practice this often means that overflow tests that are done after the overflow has already occurred (such as maybe you calculate something, then don't use the result if the calculation overflowed) are deleted, so your program looks correct (after all, you tested for overflows, right?) but isn't.
Lots and lots of things in C++ (and C for that matter) can lead to undefined behavior if preconditions are not met. Signed integer arithmetic is just one of many. If you're programming in this language, you should be used to dealing with narrow contracts.
So, no, they shouldn't be avoided. Deal with them depending on the situation, in many cases an assert will suffice. Pretending it's not a problem is fatal.
(and no, gcc isn't the only compiler that assumes that naive signed overflow checks are always false)
atof() is part of the standard C library that uses the general 'C' locale by default while stringstream is C++ which uses the current system locale by default. You can use the setlocale()[^] function to change the locale for the standard C library functions (pass an empty string to use the environment's default locale).
Am new to MFC.I have an MFC application that has to capture the device/system shut down using MFC window messages.I tried it with wm_close,wm_destroy,wm_endsession.But not able to capture.The fix should be like it has to work in xp/vista and Windows 8.0. Thanks in advance
This mass of data must be reduced with algorithms I do not know. Neural Networks works fine but in the last step I think.
Searching with Google I get Differential equations etc but this is not helpful. I need math formulars I can convert to code.
Thisismyfirstpostingatcodeproject.com, soIapologizeinadvancedforanymistakes. Iwanttodevelopasimple C++ applicationswhichcanrunforWindowsXP, 7, 8. Iwantapplicationtobesimpletoinstallandrunontheseplatformswithoutaneedfor .netframework. KeyhereisniceskinnedUI.
IdidsomeresearchontopicandcheckedvariousapplicationsyoucandownloadfromtheInternetandonethatcaughtmyeyeisSlimCleanerathttps://www.slimwareutilities.com/slimcleaner.php . If you click on Screenshot you can see the UI. I installed it on Win XP, 7 and 8 and it looks the same on all three platforms. From the .exe and included DLL it does not appear to be a .net application. This is the listing of the installed folder:
cleaner.db649KB 9/15/2014 9:22PMDataBaseFileMyDefragDll.dll649KB 7/18/2012 6:47AMApplicationExteservice.db7KB 9/15/2014 9:22PMDataBaseFileSlimCleaner.exe29,623KB 7/10/2013 9:53AMApplicationSlimShell64.dll673KB 7/10/2013 9:53AMApplicationExtenSlimShell.dll559KB 7/10/2013 9:53AMApplicationExtenstartup.db10,841KB 9/15/2014 9:22PMDataBaseFileMyquestioniscansomebodypleasehelpmeunderstandwhattoolstheyused, whatdevelopmentenvironment, andAPI. IsitMFC, Winformsor WPF? Thelatertwoare .net, asfarasIunderstand, butmaybetheyarejustcompliedasstandaloneapplication. Thingthatthiscaughtmysysisthat .exeis30MBissize. Itappearsthatthewholeapplicationisinthatsingle file!
AsanewtoWindowsdevelopmentIdonothavealotexperienceandifsomebodyalsocangivesomehintsandideaswhenIseeanapplicationwiththeUIIlikehowtofigureoutwhattheyusedtodevelopit. Iamnotinterestedinreverseengineeringtheapplication, justtofigureoutisitMCFbase, WinformsorWPF, isitdoneinVisualStudioor C++ Builderetc. Maybewhattoolstheyusedforskinningetc.
Thank you for your response. It is not an issue of weather to learning MFC or not, it is an issue of wanting to make a right choice up from. If I pick MFC and then later on I find out the Winforms would have been a batter choice it would not be a pleasant realization. MFC is being depreciated by Microsoft so it makes sense to pick something that is going to be around. Further due to the requirement to run on Windows XP, 7 and 8 without .net framework makes it questionable if Winforms or WPF can be used. On the other hand from what I have read it appears that there may be a way to compile a Winforms or WPF into a stand alone application which can be run without .net frameworks.
So before embarking on these adventures I thought to seek some advice and pointers from those who have sailed these waters before me. If I know for sure that let’s say Winforms can be compiled into a stand alone application which does not needs .net frameworks than that would be a good choice to pick. Thank you for your replay anyway.
I have written a client-server program using VC++ 2012 console application, which works on local network properly. But I want to connect to the server program on the internet using client program. I have the computer IP that server program is run on. How can I connect to server program by client?
Thank you for your advice, But it didn’t work. I decided to run server program on one of computers in my office. For this purpose I got that computer’s IP address from http://myip.dnsomatic.com and used it in server program. But error code 10049 was returned. (Cannot assign requested address) :