|
Its really bad that you have kill a process to get your work done unless that is not your developed process.
-prakash
|
|
|
|
|
Hello..
I'm trying to read in data coming from the serial port.. the data can come in at any time (so the program has to monitor the serial port continuously, thats why i'm using a while loop in my code below). I'm reading Tag IDs (strings) which are formatted into packets.. each packet starts with the '&' character and ends with the '$' character..
Right now I read in the whats coming from the serial port (using a infinite while loop) into a string and then tokenize that string according to my packet delimiters.. the problem is that Readfile is returning after getting part of the tag ID packet and then the remaining part of the tag ID packet comes the next time the while loop is called.. I think its something to do with the way I use the readfile function in the while loop..my code is given below.. Please advice..
Thank you for your help..
<br />
<br />
char buffer[200000];<br />
<br />
while (true)<br />
{<br />
printf("In while\n"); <br />
<br />
memset(buffer, 0, sizeof(buffer));<br />
if (ReadFile(h, buffer, sizeof(buffer)-1, &bytesRead, 0))<br />
{<br />
printf("Read file has a result\n"); <br />
if (bytesRead != 0)<br />
{<br />
printf("Got some bytes\n"); <br />
printf ("%s", buffer);<br />
<br />
printf( "Tokens in buffer:\n" );<br />
<br />
token = strtok(buffer, "&$" );<br />
<br />
while( token != NULL )<br />
{<br />
<br />
printf( " %s\n", token );<br />
<br />
token = strtok( NULL, "&$" );<br />
}<br />
<br />
}<br />
<br />
else <br />
{<br />
printf("No bytes read\n"); <br />
}<br />
}<br />
<br />
else {<br />
printf("Readfile didnt give proper result \n"); <br />
}<br />
Sleep(200);<br />
}<br />
<br />
|
|
|
|
|
Hi all -
My project requirement says to create a daemon program to communicate with a DLL for data exchange. I have some questions regarding the daemon program. Any pointers would be helpful.
1. Daemon is equivalent to "Services" in Windows? A service can be non web-based as well? (I search on internet, I find only web based services every where)
2. How do you create these services in Visual Studio 6.0.
which technology you use?
3. Is the service going to be an ATL COM+ based service?
4. Any articles, knowledge base in internet for these?
Thanks in advance
Misha
|
|
|
|
|
misha_grewal wrote:
1. Daemon is equivalent to "Services" in Windows? A service can be non web-based as well? (I search on internet, I find only web based services every where)
yes, it is.
misha_grewal wrote:
How do you create these services in Visual Studio 6.0.
which technology you use?
you can use ATL wizard.
misha_grewal wrote:
Any articles, knowledge base in internet for these?
http://www.codeproject.com/system/windows_nt_service.asp#xx490705xx[^]
|
|
|
|
|
Hello, I basically want to make a function that will take in any interator and perform operations on it. For example, if I had the function: >mySort( iterator, iterator ) I would be able to pass in a std::vector iterator, a std::set iterator, a std::list or any iterator defined for a customized container, or any other STL container. Is this possible??
Mike - I love to program!
|
|
|
|
|
allenmpcx wrote:
Is this possible??
Yes, but it needs to be a template function, not a function. For examples, see standard algorithms[^].
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-- modified at 21:47 Wednesday 28th September, 2005
|
|
|
|
|
These are all good, however when I try to take the ideas and implement them, I get errors, or they don't work correctly. Are there any examples that would do a simple sort using iterators only??
Mike - I love to program!
|
|
|
|
|
|
template< class Iter ><br />
void InsertionSort( Iter first, Iter last )<br />
{<br />
Iter step;<br />
Iter i;<br />
for( step = first; step < last; step++ )<br />
{<br />
Iter temp = first;<br />
for( i = step; i >= first; i = (i-first) )<br />
{<br />
if( (*temp) < (*(i-first)) )<br />
{<br />
(*i) = (*(i-first));<br />
}<br />
else<br />
{<br />
break;<br />
}<br />
}<br />
(*i)=(*temp);<br />
}<br />
}
I'm trying to make it so I can pass in any iterator from any container, however this won't even compile.
Mike - I love to program!
|
|
|
|
|
allenmpcx wrote:
however this won't even compile
and the compiler says...???
(please be complient and provide all the infos that could help man)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I was actually able to fix the previous problem by implementing std::iterator_traits< typname Iter >, however, is there a way to make a quicksort algorithm using iterators? I saw lots and lots of implementations using integers, but I need my quicksort algorithm to accept an iterator from the list or a vector. Is this possible?
Mike - I love to program!
|
|
|
|
|
Hi, i'm a newbie programmer fascinated by the inner workings of search engines. I would like to know if any one has an idea what language(s) would a search engine like google use, and what language would you use if you were planning to create a very very basic web search engine. And also, and since i'm a C++ programmer, I wanted to know if C++ could play any role in this job!
|
|
|
|
|
Silly answer: Google specifically uses pigeons! .
Real answer - I suspect google and the like use C and C++ as their mainstay for the actual search technology. No evidence to back this up, mind. I do know that Google use Python as their script language; indeed their support forum pages seem to run exclusively in Python.
As for implementing itself - it's a daunting task. First you need a way of getting the data. You'll need a way of querying many web sites and storing the pages in an indexable way - as Patricia_tries, or one of many many other clever ways of storing data for searching. You'll need a huge amount of storage for this kind of thing - I dread to think how big Google's databases are. You'll also need a lot of internet bandwidth to suck in all the pages you want to index. Of course, if you're only interested in learing about how these things work, you can scale back and just index say one site. For that, you could build a little SQL database of all the words on the site linking to the page the words are found on, etc. This 'spider' program is an ideal candidate for a C/C++ application.
Then you need a way of searching through the data; a web application is usually the way to present web searches. Either write a cgi-bin script for your web server (e.g. Apache) or implement it as a plugin directly to the web server. Or, if you're just more interested in getting something up and running quickly, perhaps consider Python, PHP or Perl extensions to your web server, querying the SQL database you made in part 1.
Hope that helps - happy coding!
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
|
|
|
|
|
Hello! I have just started to learn about linked list and would like to try to insert a set of random numbers into a linked list. I'm confused as to how to go about. I can insert a single number but dont have a clue as to how to do it with set of number. thanks for the help.
|
|
|
|
|
eprt wrote:
I can insert a single number but dont have a clue as to how to do it with set of number.
How is the set stored ? The most obvious way to add random numbers is in a loop - they are not pre existing data, they are random, so just keep your random number generator passing values to push_back until you have as many as you need.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was wondering if someone could be so kind as to explain or recommend an article/ book that could help explain this for me.
I have a question about Handles. What happens to the underlying object when there are no more handles pointing to it?
Is it lost in memory somewhere or does it get deleted and cleaned up for you?
here is an example.
<br />
ref class A {<br />
public:<br />
property Int32 i;<br />
};<br />
<br />
int main(array<System::String ^> ^args) {<br />
A^ foo = gcnew A();<br />
foo->i = 5;<br />
A^ bar = gcnew A();<br />
bar->i = 13;<br />
<br />
foo = bar;<br />
<br />
return 0;<br />
}
What happens to the first object that has a value of 5?
Since, I no longer have a handle to it, will it still be floating around in memory somewhere?
Thank you,
|
|
|
|
|
If you call gcnew, you're asking for a managed object which means it will be garbage collected for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
i have to implement a neural network but unfortunately i have no experince or idea how to implement or start implementing a artificial neural network. if anyone could please guide me how to start implementing or show an example of implementing any simple artificial neural network or any evolutionary algorithm it will be a great help.
|
|
|
|
|
Hmm... maybe you can start by checking out pseudonym67's article here: Neural Net Part 1 and then continue with pt 2 and 3. Also I remember reading an article about OCR using neural nets that was also implemented using .NET. You may want to do a search... maybe narrow your search a little after you learn a bit about what you're actually searching for.
good luck!
|
|
|
|
|
Hi, I'm new to managed C++ and I was wondering how could I use fopen from managed C++
I have to call a legacy function that uses FILE but when i try to compile my code I get the following errors
fatal error LNK1120: 2 unresolved externals
error LNK2020: unresolved token (0A00002C) delete
error LNK2020: unresolved token (0A000018) _CxxThrowException
the code looks something like this
#pragma once
using namespace System;
//using namespace System::IO;
using namespace System::Runtime::InteropServices;
#include <openssl rsa.h="">
#include <iostream>
namespace OpenSSLWrapper
{
public __gc class RSAWrapper
{
public:
int RSAEncryption()
{
RSA *privateKey;
FILE *keyFile = fopen("C:\\Documents and Settings\\isaac\\Desktop\\Factura\\.key", "r");
if (keyFile == NULL)
return -1;
fclose(keyFile);
Byte sourceArray[] = __gc new Byte[2];
Byte encryptedArray[] = __gc new Byte[5000];
{
unsigned char __pin *source = &sourceArray[0];
unsigned char __pin *encrypted = &encryptedArray[0];
sourceArray[0] = 7;
sourceArray[1] = 5;
}
return 0;
}
};
}
Thanks in advance
Isaac B
|
|
|
|
|
How you have created this project?
I've tested your code, with project created in VC++ project--> console Application(.Net) and didn't get any error.
|
|
|
|
|
I've got a little problem with some code :
My program is in C, doesnt'use use any custom or foreign libraries !
No compile errors are noticied and it works as i want when VS start the app in release and debug mode. But when i try to execute outside (without VS), simply doubleclicking on the exe; my program hang ! They hang not at the same point during the execution.
My program use a lot of pointers, and malloc, which are freed without memory leaks !
Please help !
Thanks for incoming answers !
|
|
|
|
|
Hi,
Do you have any large arrays statically allocated?
I take it that if you have no errors, there are no warning either?
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
You do not use any foriegn libraries, but the C run time library used is different in debug/release builds and heap management is quite different in debug/release builds. Debug takes care of when you overwrite array bound etc..
but release doesnt..there are differences like this.
|
|
|
|
|
hai guys
difference dynamic & static in window programming.
b.raju
|
|
|
|