|
ytubis wrote:
Error 1 error C2146: syntax error : missing ';' before identifier 'tcplib_retrieve_n_bytes_ptr' d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int d:\my_documents\visual studio 2008\projects\servertest\servertest\servertest.cpp 6 ServerTest
That means that the compiler can't see the defintion of TCPLIB_RETRIEVE_N_BYTES_PTR - you need a definition of the type for the compiler to see. DLL's can't export type definitions, only functions and variables (and don't think that DLLs export classes as types - they don't, they export the class's methods).
ytubis wrote: I added the DLL to my linker as an input but I get errors:
You need to add the import library to the linker input, NOT the DLL.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you very much.
But let me understand:
I have created TCPlib.dll, this is the build for the library.
I add this dll to the new project where I try to extern the function pointers.
in the input linker I gave TCPlib.lib and another time TCPlib.dll
and I get that the project can not find them:
Error 1 fatal error LNK1104: cannot open file 'TCPlib.lib' ServerTest ServerTest
I have the dll in the library of the project and also attached to the project as an Item.
what am I doing wrong?
Thanks for your help
|
|
|
|
|
Unless the DLL project is in the same solution as the executable's project and you've added the DLL project as a dependency of the executable one, you also need to tell the linker what directory the library (that is, TCPlib.lib) is in.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I know here is NOT a suite forum to ask such a question; but I couldn't find any answer on the Internet.
Recently I can't browse any URL including the word "Microsoft" !!! I have two browsers: IE and Opera, both with the same problem. As soon as I click the "browse" button (go) or press "Enter" key, "Internet Explorer cannot display the webpage" (IE) or "Could not locate remote server" (Opera) is shown. Any idea?
Thank you masters!
|
|
|
|
|
The recent Confickr virus is said to block a list of sites, including Microsoft and all major antivirus vendors.
|
|
|
|
|
Does seem like that. For a good test, open a command prompt & ping microsoft
i.e "ping www.microsoft.com"
It should resolve to something like: 65.55.12.2491 - when I was affected by something last week, all addresses involving microsoft and many anti-virus vendors were being resolved to 127.0.0.1
I got around this by doing a dns lookup on www.microsoft.com, then substituting that ip for any part of the url that was www.microsoft.com (Same with avg and avira, etc)
e.g
I want www.microsft.com/downloads/somefile.zip
www.microsoft.com is being resolved to my loopback address, so I insert the ip that this should resolve to into the address bar --> 65.55.12.2491/downloads/somefile.zip
The problem lay in a registry key contained within
HKLM/Software/Microsoft/Windows NT/CurrentVersion/Winlogon it was UIShell, or something like that. (it was NOT UIHost, that is a neccessary entry)
The key points to an executable file that is run on start-up and proceeds to hide itself from directory searches, as well as hiding the registry key needed to remove it!
The solution? Use a program that uses direct registry access - The registry keys can't be hidden then since we're not using the wnidows api Registry calls that the virus has already hooked.
You should have a look for GMER - that's all I needed to access and repair the registry (make sure you get a new version from the author's website).
Oh, and btw - it wasn't conficker, dunno what it was - AVG reckons that the file is clean
|
|
|
|
|
Hello,
I have HL7 message. I want to parse it. I want only Patient Name from the segment Patient Identification(PID), then how can i get or retrieve this particular data field from the message segment?
|
|
|
|
|
From what I've seen (in the last five minutes, by Googling 'HL7' and 'HL7 PID' - you have heard of Google, I presume), each message segment is on a separate line. Each segment consists of fields separated by a '|' character. This page[^] defines the PID segment. This page[^] defines the data type of a person name.
So - you're looking for a line starting 'PID'. Now look through that line for '|' characters. The patient name is between the 5th and 6th '|'.
I'd probably use a regex, like:
^PID(\|[^|]*){4}\|([^|]+)\|.+$
so the patient name field ends up in match #2. With Boost.Regex, this looks like this (using an example message segment I found on the web):
boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
boost::smatch match;
if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
else
{
cerr << "No match" << endl;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
in VC++, is there any boost::regex class or namespace?
sorry, but i am not getting what u r written.
|
|
|
|
|
Boost is a third-party set of libraries - see Boost[^] and Boost.Regex[^].
If you're using VC++ 2008, you should have regular expressions in std::tr1::regex[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
what it means:-
boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
and in if condition
if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
|
|
|
|
|
Abhijit D. Babar wrote: boost::regex rePID("^PID(\\|[^|]*){4}\\|([^|]*)\\|.*$");
That's declaring a regular expression object. I'm not even going to try explaining what regex syntax is - I presumed that as you used the word 'parse' you'd have some appreciation of regular expressions - have a look at some[^] regex[^] tutorials[^].
Abhijit D. Babar wrote: if (boost::regex_match(std::string("PID||0493575^^^2^ID 1|454721||DOE^JOHN^^^^|DOPE^JOHN^^^^|19480203|M||B|254 E238ST^^EUCLID^OH^44123^USA||(216)731-4359|||M|NON|400003403~1129086|"),
match, rePID))
{
std::cout << match[2] << endl;
}
Does the regex in rePID match the string I provided? If so, then the patient name is in the second regex capture, which can be accessed using match[2].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks for your reply.
This method works fine. Like this, instead of doing coding is there any free Toolkit which give directly the segment or data field user want? Because we can parse message as you show above, but it is very complex to make string for every data filed and in future if HL7 message format will change, we have to change our code syntax also. So if inbuilt parser or toolkit is available then i think work will be more simple.
Thanks in advance....
modified on Saturday, April 18, 2009 9:15 AM
|
|
|
|
|
Abhijit D. Babar wrote: This method works fine. Like this, instead of doing coding is there any free Toolkit which give directly the segment or data field user want?
I seem to remember mentioning Google[^] before...didn't sink in, did it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello guys,
I want to split a string into substrings using strtok(). The code is
#include "stdafx.h"
#using <mscorlib.dll>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace System;
using namespace std;
char str2list(char* str, char** list, const char* delimiters)
{
for (char c = 0; c < sizeof(list) / sizeof(char*); c++)
{
list[c] = strtok(str, delimiters);
if (list[c] == NULL) break;
}
return c;
}
int _tmain()
{
char** arglist;
arglist = new char*[16];
char* exmp = "I have a problem!";
str2list(exmp, arglist, " ");
for (char c = 0; c < sizeof(arglist) / sizeof(char*); c++)
{
cout << arglist[c] << endl;
}
delete[] arglist;
return 0;
}
</stdio.h></string></iostream></mscorlib.dll>
When I try to execute the program a runtime error occurs saying that there is a null-reference exception in the line list[c] = strtok(str, delimiters); . To ensure that there is enough free memory I even used the new operator.
Does anyone have an idea why this doesn't work?
Thanks and best wishes.
|
|
|
|
|
Austrian_Programmer wrote: When I try to execute the program a runtime error occurs saying that there is a null-reference exception in the line list[c] = strtok(str, delimiters);. To ensure that there is enough free memory I even used the new operator.
That's because (although exmp is a char* ), it's pointing at a string stored in read-only memory (string literals are read-only). strtok needs to write to it. It can't, so you get a runtime exception. Change
char* exmp = "I have a problem!";
to
char exmp[] = "I have a problem!";
and the crash goes away, because now you've allocated a read/write character array and initialised it from the (read-only) string literal.
There are many other issues as well, however:
- Look at the
strtok documentation[^] - you only pass in str on the first call to strtok for that string - the rest of the time, you pass in NULL . - The loop condition in
str2list is all wrong. list is a char** , so sizeof(list)/sizeof(char*) will be equal to 1. If you want to be safe with respect to the size of list , you need to explicitly pass it in - C/C++ doesn't pass around array sizes with arrays. - Similarly, the loop condition in _tmain is wrong (although this problem goes away if you take note of the next point).
- There's no point using
new when you have a fixed array size - declaring arglist with char* arglist[16]; will work just as well. - I'm...interested that you use
char as the type of the loop variables - Although the for loop in
str2list may compile with the compiler you're using, it won't with VS2008 (and possibly won't with earlier compilers), and isn't compliant with the C++ standard - going by the standard, your loop variable isn't accessible outside the loop. - You return the number of tokens in the list from
str2list ...and then don't use it. Mmmmm.
Anyway - here's my fixed (I think) version of your code.
#include <iostream>
#include <string.h>
using namespace std;
int str2list(char* str, char** list, int maxTokenCount, const char* delimiters)
{
for (int c = 0; c<maxtokencount;> {
list[c] = strtok(str, delimiters);
if (list[c] == NULL) return c;
str = 0;
}
}
int main()
{
char* arglist[16] = {0};
char exmp[] = "I have a problem!";
const int numToks = str2list(exmp, arglist, 16, " ");
for (int c = 0; c < numToks; c++)
{
cout << arglist[c] << endl;
}
return 0;
}
[edit]Just for laughs, I did a version using STL and C++ classes, for those of us who like type-safety and nice things like that. It is special cased for the situation where the separator is a space (you can alter that by playing with locales and facets, but that's an exercise for the reader), but anyway.
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
vector<string> split(string const& exmp)
{
istringstream s(exmp);
return vector<string>(istream_iterator<string>(s), istream_iterator<string>());
}
int main()
{
string exmp = "I have a problem!";
const vector<string> toks = split(exmp);
copy(toks.begin(), toks.end(), ostream_iterator<string>(cout, "\n"));
return 0;
} [/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
modified on Saturday, April 18, 2009 11:11 AM
|
|
|
|
|
Thanks for the answer.
I've done a lot of microprocessor programming in the last time and there I use char whenever possible (it's the smallest type and working without causing any troubles). However, that's pure C and there are (I know) a few differences to C++. Normally I use C++ for game programming and mathematical things and that's more or less the first time I do something with strings in C++, so this is all in all just a try.
|
|
|
|
|
Austrian_Programmer wrote: Normally I use C++ for game programming and mathematical things and that's more or less the first time I do something with strings in C++, so this is all in all just a try.
That's cool - if you're starting out with C++ on a desktop platform, I really would recommend learning about the Standard Template Library - it makes (some) things a lot easier, especially managing strings and arrays (or vectors, which is the closest thing to an array in STL)..
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
What technologies/libraries/protocols I need to study to develop a video system similar to skype or
MSN messenger? I prefer coding in C++.
To be more specific:
How do I capture the video feed from the webcam? And how do I play it back?
How do I capture sound? And how do I play it back?
How do I stream it over the internet? Do I use sockets?
|
|
|
|
|
Hiigara wrote: What technologies/libraries/protocols I need to study to develop a video system
SIP & RTP is common protocol for VoIP. That so many system follows. Skype is more sophisticated peer to peer protocol.
If you are looking for developing server for video conferencing then there is already open source Voip server called Asterisk[^].
Hiigara wrote: I prefer coding in C++.
C++ is good to work if you choose java then java (Java Media Framework) give you more easy API to handle video/audio streaming.
I have no knowledge of .Net technology.
For more detail of Viop software & library you can refer here[^].
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
modified on Saturday, April 18, 2009 1:49 AM
|
|
|
|
|
DirectShow in the Windows SDK.
XAudio/Dsound in the DirectXSDK
or you can just use a plain WaveIn/Out API to record the sound for you.
Yes, you need sockets.
|
|
|
|
|
I have an application that uses a ISA card to control motion of flight simulator. The ISA card is controlled by C++ classes inside MFC Application. I recently decide to package the ISA card C++ control class into it's own DLL. This will enable me to use other manufacture motion cards at a later date. However, After placing the code into a DLL and change the application to load the library DLL and at start up. I find the application is not performing as fast as it use to? How much overhead does a DLL really add? Is it possible that DLL is my problem here? Where does the dll get it's runtime priority? Is it from the calling appication or do i have to sent it myself.
Scott
732-300-9956
Scott Dolan
Jernie Corporation
Engineering & Manufacturing
Software, Hardware, & Enclosures
|
|
|
|
|
ScotDolan wrote: Where does the dll get it's runtime priority? Is it from the calling appication or do i have to sent it myself.
DLLs don't have a priority - threads and processes do. So, yes, the priority of the DLL's code will come from the calling app.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
if your program's performance isn't what it used to be, then you must have changed something. Assuming all the functions and data structures remained the same, it must be related to compiler/linker settings, e.g. maybe your EXE was and still is optimized, but your new DLL is not? I suggest you compare the DLL settings with the current or previous EXE settings.
|
|
|
|
|
Hello everyone. I come from a Delphi background to VC++ 2008. I have searched the board and articles for my "problem" but to no avail. I hope someone out there can help me with this even tho it may sound like a very dumb question. The entire problem could probably be resolved with a different approach but this is what I have so far so feel free to modify/suggest whatever you feel may help.
1. after a button is clicked, a do ... while loop is started
2. in the middle of the loop, webBrowser is "told" to do a webBrowser->Navigate
3. an url keeping variable is updated by incrementing one of the integers needed to get the right url
4. integer variable is incremented
5. loop keeps going up and webBrowser navigates again (this time to a different address) until the integer variable = user specified number
This loop can, based on user input, be executed 10+ times or so, basically telling the webbrowser to navigate to 10 different urls.
The problem is - the loop will prevent the webbrowser to fully finish loading the site and at the end it manages to navigate to 1 url only.
I understand that I need to use the DocumentCompleted event on the webBrowser.
The question is: how do I combine the loop with the event?
Is there backgroundworker or some other component I should use?
I hope I provided enough info for the answer. Feel free to ask for more details/code if needed.
|
|
|
|
|