|
try:
while(fscanf(pFile, "%d %s %s %f", &sNum, paramId, paramUnit, ¶mValue)...
Bram van Kampen
|
|
|
|
|
chuckle, I missed that one completely
'g'
|
|
|
|
|
Easy thing to Miss!
Chased one similar to that last week in my own code for 2 hours. At least the OP set it to '0' (NULL) to begin with. I had not done so, and made it far more difficult to trace.
Bram van Kampen
|
|
|
|
|
it works.it takes me about three hours to try to solve it.
thank u very mnuch.
i 've tried ,then i have no regret
|
|
|
|
|
Has anyone succeeded in getting the Visual C++ 2005 runtime or .NET 2.0 to work in Windows PE 2.0? Everything I've found online (such as here[^]) indicates no one has gotten this to work except some guy who goes by Zoronax, but he never described how he got it to work. I did find a plugin[^] that is supposed to work for PE 1.6, but not PE 2.0, so that does me no good
I'm trying to automate our workstation backups in Windows PE, and I need to determine which user belongs to a given machine. We figured the best way is to compare the MAC address against a text file that maps MAC address to user name. I tried doing this in a batch file using
FOR /F "tokens=2 delims=:" %%I IN ('ipconfig /all ^| find /I "Physical Address"') DO 'process file here' but the %%I variable has a trailing CR at the end and I can't seem to get rid of it. Since that wasn't working, I wrote a small C++ utility to do the comparison and display the user name. It works find in XP and Vista, but I get a "side-by-side configuration is incorrect" error in Windows PE. I assume this means I need to install the Visual C++ 2005 runtime. When I try to run the installer for it, though, msiexec throws a "File could not be found" error. Any ideas?
Thanks,
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
modified on Monday, January 18, 2010 7:23 PM
|
|
|
|
|
After some more searching, I ran across this thread[^] that suggests using static linking. I'll give that a try tomorrow and see if I have any luck.
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
I have done quite a bit of work with WinPE and yes statically linking the runtime is the best solution for your own code.
However standing back a second, you do know that you can add packages to the WinPE image and one of these is:
WinPE-Scripting
Windows Script Host (WSH) support. Enables batch file processing using WSH script objects.
So rather than going to the trouble of creating an executable you can use VBS or JS with Cscript.exe to do the work. This might give you mor felixibility in the long term.
Also watch out for dependancy issues. I have a WinPE image I use for data recovery, forensics and general stuff in which I use a number of freeware tools. A lot of these have late binding dependancies which, once you know what they are, are simple to resolve by copying the dependant DLL's in to the WIM.
Alan
|
|
|
|
|
Alan,
Thanks for the suggestions. I ended up going with VBScript and it works perfectly. I based my solution off of an Experts Exchange post from this Google search (9th entry from the top)[^].
Dybs
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
|
Put something like the following in a source file:
#ifdef MY_CONDITION
#pragma comment(lib, "libA.lib")
#else
#pragma comment(lib, "libB.lib")
#endif
If the lib(s) are included as dependent projects in the solution then you may need to disable auto linking of dependent projects in the project settings or it may try to link the wrong one.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Thanks for the reply.
I will try what you suggest.
|
|
|
|
|
For future reference, it is considered rude to delete your original question.
Now people can not read the forum, and see why you were helped, and they can no longer become wiser themselves.
The only reason to remove a message if if you were calling someone a rude name, and you regretted it later.
That said, I'm glad you were helped, and the world is a better place in your little corner.
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
Hi cmk.
Your suggestion did the trick - thanks
Tony
P.S. Appologies for deleting the original message - not quite sure how it happened
|
|
|
|
|
hello, i need to change the appearance of a spin control , is there any way to do this?
|
|
|
|
|
Yes - have a look at this article[^] which shows how to make an owner drawn version of the spin control.
Graham
Librarians rule, Ook!
|
|
|
|
|
Hey guys, im quite new to c++. i am doing a project in which i would have to extract certain information of a database which i have saved in a text file. the database looks something like this :
Database<br />
John32451^23.21 >tyyhg>tdsrte^>1.24<br />
Mark55342^ 335.11 >tsthh
What i am trying to do is search each row based on a specific id and then extract the information next to it. For example, if i were to select John in the menu, the output will be like this.
OUTPUT<br />
John 23.21 1.24
I am not very sure how could i do this and the method to use. Could i get some guidance? To get the correct line will be easy as we just have to search for the name to get the line. But , how about the other two information? I was thinking of using the characters before it which is "32451^" and then reading the info. but how do i get it to stop at the information i want and not continue displaying the information after that which is ";gt;t"
|
|
|
|
|
I suggest you put the data in a real database table. That way you can search the information you want using SQL instead of writing all the code to find the values you want from a text string.
|
|
|
|
|
i cant do that cos the information is coming from a html file. so i have to read it as a text file then use unique id attibutes to make sure i am on the right string , and which line to get the info from.
For example :
<br />
Nasdaq</a></td><td><span class="streaming-datum" id="yfs_l10_^ixic">2,287.99<<td colspan="4"><div style="height: 0px;<br />
the information which i have to retrieve will be "2,287.99". i studied the code and i realize that , the id before it is unique,(id="yfs_l10_^ixic">) , so i can search for it. the problem i am having is how to i tell the prog to save the information which i want and not save the other lines of text?
|
|
|
|
|
You need to write a Scanner.
The simpelest way would be (but this may not suffice):
You open the html file, and read it line by line.
You then search for the string id="yfs_110...>"
Your number follows this string, and the number ends before the deinmiter'<'. So, scan your string until you find the '<' and set it to 0.
Voila, your required Number string, Copy it, and do with it as you please.
Regards,
Bram van Kampen
|
|
|
|
|
Hey thanks for the tip. Is there any example programs or tutorial which u know that can help me with the problem i am having?
|
|
|
|
|
gregarion wrote:
What i am trying to do is search each row based on a specific id and then extract the information next to it
Have a look at regular expressions (RE). There are various libraries for C++, see Boost or CodeProject articles. Alternatively, you could pre-process the data with a Python or Perl script, they are ideal for this kind of work and have regular expressions built-in. You could scan line by line trough your HTML-input and with a regular expression test/extract the wanted information.
Hope this helps,
M
|
|
|
|
|
Yep, you read correcly, my app is spontaneously forking itself - in windows!
I've written a command-line native C++ app with VS2008 to measure temperature data using a Dallas Semiconductors 1-wire hardware and storing the data in a MySQL server. No MFC or .NET stuff. For this I use the Dallas Semiconductors TMEX SDK (link below) and the MySQL C++ connector.
My app is strictly command-line, is run with scheduler once every minute, and exits normally after a second or so. Most of the time, 98% of runs, everything is fine - no error messages, data stored correcly and all that. But sometimes, about once every hour (though not consistently) the app splits in two (or is possibly run twice). I have included some simple logging of key events in the app, storing them in a textfile along with the process IDs, which are indeed different. It LOOKS like the app is simply started twice, almost simultaneously, each process doing it's work correcly and then exiting. The temperature hardware cannot be shared, so one of the processes pauses to let the other one finish, and then carries on itself. Still no error messages, and nothing in windows logs. The temperature data is simply measured and stored twice. I use the simpliest of C++ language, no threading, no registering of windows classes, nothing. I DO use LoadLibrary to import a DLL for hardware access, and GetCurrentProcessID for logging, but no other WINAPI functions I can think of. Other than the ones used by the MySQL C++ Connector, of course.
What about the scheduler then? Well, I've tried both windows scheduler and an old one I made myself back in the days when the built in windows scheduler couldn't do work once every minute. Same result, except that my own scheduler seems to give the error slightly more often, and more erradic. I've tried to run the app using "CMD.EXE /C [myapp.exe] [my_args]" or "myapp.exe [my_args]" directly with the same result.
The behaviour is identical on two servers, a Windows 2008 R2 x64 on dual-core CPU, and a Windows 2003 original x86 on single core x64 CPU. The former runs a 64 bit version of the app (with a 64-bit DLL), and the latter of course a 32-bit version.
Has anyone dealt with anything similar? Where do I need to look? Anyone seriously interested in helping out please mail me for source code.
Best regards
Måns
TMEX SDK: http://files.dalsemi.com/auto_id/softdev/owdocs_400beta2/Docs/1-Wire_SDK_Help.html
|
|
|
|
|
I think no fork happens. Why don't you make your application permanently running, doing measurement once a minute (this way dropping off the coupling with any scheduler)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi
Well, a continously running app doing the work once every minute is also a valid way of doing it, preferably as a system process. One of the main reasons for doing it command-line with scheduler though was that if there was a hardware error, the app might lock up. With the current way of doing it, even if the app crashes, the sheduler would just restart it the next minute.
But the main question remains - how can the app be duplicated in this strange way? With two separate PID's?
I now added a Mutex, so the second process immediately exits upon detecting the first process, but hey - that's really insane!
/Måns
|
|
|
|
|
I suppose it is a problem related to the scheduler (no forking happens), suppose the scheduler has to defer it's action, then may happen that it has to launch two instances of your application at practically the same time (it is just a guess, however).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|