Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Sebastiani

    general purpose scanner

    Hello all, I have here an stl-based scanner/tokenizer object that some of you might find useful. It is completely free. http://flashdaddee.com/forums/attachment.php?s=&postid=97313 - Cheers Sebastian G.
  2. Sebastiani

    Thread Programming

    To check if a thread is running, use GetExitCodeThread(), ie: bool thread_active(HANDLE thread) { DWORD status; GetExitCodeThread(thread, &status); return status == STILL_ACTIVE; }
  3. Sebastiani

    CAsycnSocket issues

    Don't use MFC, personally (thank god!). But I did notice this: >>m_sConnectSocket.Send(LPCTSTR(m_strCardNumber), iLen); If m_strCardNumber is an std::string, you shouldn't be casting it to a char*, since the object doesn't define an operator char*() function (implicit conversion operator).
  4. Sebastiani

    Basic Winsock Problem.

    No, you're still off. The struct member S_addr is an unsigned long. It makes no difference. Look: struct foo { unsigned long var; }; foo bar; int sz = sizeof(bar.var); or... int sz = sizeof(unsigned long); Do you see why?
  5. Sebastiani

    Concatenate a variable to a string

    Try out a good ole C solution: char buff[256] = "Time remaining: "; char cat[256]; sprintf(cat, "%d", 101); strcat(buff, cat); printf(buff);
  6. Sebastiani

    Accessing a specific memory location

    >> IonFilipski Almost: int address = 0xffffffff; char * dangerous = (char*)address; // cast necessary >> adholioshake It doesn't matter whether you use ASM or C here. What *does* matter is the operating system you're running. Under a protected mode OS such as Windows, dereferencing the...
  7. Sebastiani

    *another* basic Winsock Problem.

    ...sock, unsigned long address, unsigned short port = 80) { sockaddr_in local; memset(&local, 0, sizeof(local)); local.sin_family = AF_INET; local.sin_port = htons(port); local.sin_addr.S_un.S_addr = htonl(address); return ::bind(sock, (sockaddr*)&local, sizeof(local)) != SOCKET_ERROR; }
  8. Sebastiani

    mkdir

    Hmmm...pretty elementary stuff, are you that much of a newb? :p Post the entire program so we can see how far you got, first.
  9. Sebastiani

    Exponents don't work!

    ...num, double count); That of course should be: >> power=pow(num, count); Now for a couple of nitpicks. >> cin>>num; cin should *always* be followed up with a: >> if(cin.good()) // safe to proceed Finally, cin.get() can be used instead of getch(), meaning you wouldn't have to include...
  10. Sebastiani

    Object Model Trouble

    Could be you declared a member function, but didn't define it, ie: struct foo { void bar(){ } // declared and defined void baz(); // only declared };
  11. Sebastiani

    mkdir

    #include <io.h> // for mkdir() #include <iostream> int main() { if(mkdir(&quot;C:\\MyDirectory&quot;)==0) cout << &quot;Success!&quot;; else cout << &quot;Could Not Create Directory!&quot;; cin.get(); }
  12. Sebastiani

    *another* basic Winsock Problem.

    ...long address, unsigned short port = 80) { sockaddr_in local; memset(&local, 0, sizeof(sockaddr_in)); local.sin_family = AF_INET; local.sin_port = port;//...also tried htons(port)... local.sin_addr.S_un.S_addr = address; return ::bind(sock, (sockaddr*)&local, sizeof(local)) !=...
  13. Sebastiani

    *another* basic Winsock Problem.

    ...= AF_INET; local.sin_port = port;//...also tried htons(port)... local.sin_addr.S_un.S_addr = address; return ::bind(sock, (sockaddr*)&remote, sizeof(remote)) != SOCKET_ERROR; } The two addresses I tried as the second parameter were the manifest constants INADDR_ANY and INADDR_LOOPBACK...
  14. Sebastiani

    Exponents don't work!

    It's in math.h (and cmath).
  15. Sebastiani

    Basic Winsock Problem.

    ...it tries to resolve a dotted-decimal string to an address. If that fails, it assumes a hostname was provided. unsigned long ip(const char * addr) { unsigned long address = inet_addr(addr); if(address == INADDR_NONE) { hostent * host = gethostbyname(addr); if(host) {...
  16. Sebastiani

    Basic Winsock Problem.

    O.K. got it. Thanks for the suggestions.
  17. Sebastiani

    Basic Winsock Problem.

    ...thing is that I did this a year or so ago without any problems. :-/ And yes, in the actual program I was using something like: hostent * host = gethostbyname(&quot;www.google.com&quot;); if(!host) cout << &quot;!gethostbyname()&quot; << endl; else { memcpy(&addr.sin_addr.s_addr...
  18. Sebastiani

    Exponents don't work!

    Well, let's see what you've tried. Generally a simple for() loop is sufficient.
  19. Sebastiani

    Basic Winsock Problem.

    ...addr.sin_family = AF_INET; addr.sin_port = htons(80); addr.sin_addr.s_addr = INADDR_LOOPBACK; if(connect(handle, (sockaddr*)&addr, sizeof(sockaddr_in)) == SOCKET_ERROR) cout << &quot;!connect()&quot; << endl; else { cout << &quot;Yahoo!&quot; <<...
  20. Sebastiani

    _outp _inp

    You can use ReadFile/WriteFile for windows. Unfortunately, I've no experience with port communication, so that's all I can tell you...

Part and Inventory Search

Back
Top