Dogtree 23 Posting Whiz in Training

It's a public connection that they give to anyone, but to protect you they have to provide security measures or risk lawsuits every 30 seconds or so. ;) If your connection isn't prepared to use those security measures then it won't work. It doesn't have anything to do with you giving them the necessary information to establish a link.

Dogtree 23 Posting Whiz in Training

I'm sorry you feel that way. You can go elsewhere and you probably won't be missed. To answer your increasingly rude question, I would probably use a combination of Visual Basic for the user interface and C++ for the back-end processing. But, since you clearly aren't going to be writing the software or encouraging someone to write it for you, the question of what languages to use is strictly theoretical.

Goodbye, and I hope you find a community that thrives on veiled insults, as that seems to be all you can offer.

~s.o.s~ commented: So true. +19
Dogtree 23 Posting Whiz in Training

Your best start is by reading the documentation to your compiler. There's no native support for printers in C++, and your compiler probably offers several ways to do it.

Dogtree 23 Posting Whiz in Training

Not hairy at all. If integral division results in 0, don't show it:

#include <functional>
#include <iostream>
#include <string>

template <typename Pred>
void print_if(int part, Pred p, std::string msg = "")
{
  if (p(part))
    std::cout << msg << part << '\n';
}

int main()
{
  int seconds = 1234567;
  int minutes = seconds / 60;
  int hours = minutes / 60;
  int days = hours / 24;
  int weeks = days / 7;
  int months = weeks / 52;
  int years = months / 12;

  std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
  std::cout.precision(3);

  print_if(seconds, std::bind2nd(std::greater<int>(), 0), "Seconds: ");
  print_if(minutes, std::bind2nd(std::greater<int>(), 0), "Minutes: ");
  print_if(hours, std::bind2nd(std::greater<int>(), 0), "Hours: ");
  print_if(days, std::bind2nd(std::greater<int>(), 0), "Days: ");
  print_if(months, std::bind2nd(std::greater<int>(), 0), "Months: ");
  print_if(years, std::bind2nd(std::greater<int>(), 0), "Years: ");
}
Dogtree 23 Posting Whiz in Training

Thanks for the warm welcome. :) I try to be as helpful as possible so that if I have a problem, everyone will jump to help me in return.

Dogtree 23 Posting Whiz in Training

It's as simple as this, more or less:

#include <iostream>

int main()
{
  double seconds = 1234567;
  double minutes = seconds / 60;
  double hours = minutes / 60;
  double days = hours / 24;
  double weeks = days / 7;
  double months = weeks / 52;
  double years = months / 12;

  std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
  std::cout.precision(3);

  std::cout << "Seconds: " << seconds << '\n'
    << "Minutes: " << minutes << '\n'
    << "Hours: " << hours << '\n'
    << "Days: " << days << '\n'
    << "Weeks: " << weeks << '\n'
    << "Months: " << months << '\n'
    << "Years: " << years << '\n';
}
Dogtree 23 Posting Whiz in Training

>>So much for Daniweb. Does anyone have at least a better forum I can go to?
What do you mean "So much for Daniweb"? Do you have any idea how large and complex an application like this would be? I can guarantee that you won't find a forum out there that will do anything but laugh at you unless you can provide more than a concept. Not to sound rude or anything, but the very fact that you started this thread proves that you're not capable of developing the software yet. If you don't even know what languages to use, you're not ready to write something that in the business world would take teams of experienced professional programmers thousands of man-hours to do.

"So much for Daniweb" is rude and arrogant to an extreme that I haven't seen before, and I work closely with salesman who personify arrogance.

Dogtree 23 Posting Whiz in Training

There's probably a function or set of functions that do what you want, but nothing in the standard library. It would be easier to just do it manually since the algorithm isn't that hard.

Dogtree 23 Posting Whiz in Training

Dear guy, I'm looking for information about how to display segy data. However, for your interest, you must know that with perl you could get that information easier. If you are interested, I can send you an extract of the algorithm.
Regards,
Dorian Oria

Um, chances are good that if a thread is older than a month, it's dead and the thread starter is long gone.

Dogtree 23 Posting Whiz in Training

You can format just one partition as far as I know, so yea, assuming your D: drive isn't the CD-ROM drive, you should be able to format it and leave C: untouched.

But I can't emphasize enough that getting a separate hard drive for your first Linux install is easier and safer than trying to format and re-partition an existing Windows partition. With how cheap hard drives are these days, it's a good inexpensive way to get Linux without having a really bad day. Of course, it's still a good idea to have full backups...just in case. ;)

Dogtree 23 Posting Whiz in Training

First, make sure that the wireless adapter is working properly and the network connection is enabled and set for DHCP rather than a static IP address. Search for nearby connections to make sure that you can see the wireless access point of the place you're trying to connect to. If all of that works then your problem is probably going to be something with the login. You'll probably need to check with the management to see if you need a user ID and password, and what kind of security they implement. Chances are good that if you can't connect, there's someone there, be it an employee or a fellow workaholic, who can give you a hand.

Dogtree 23 Posting Whiz in Training

Anytime. Glad I could help. :)

Dogtree 23 Posting Whiz in Training

I would think that if there's no server, that's a fatal error for the client. Since this is for testing purposes, why bother with an elaborate workaround when you can simply make sure that you run the server first?

Dogtree 23 Posting Whiz in Training

It was probably an automated attack that scans for open ports and tries to push a virues to each one it finds. The days of a cracker actually taking the time to choose targets and attack them manually are all but gone. But that's a good thing because automated attacks are easier to use automated defenses against. :)

Dogtree 23 Posting Whiz in Training

>>My ? is, do all webs get attacked all of the time????
Not constantly, but webservers get attacked on a regular basis, especially corporate webservers. If you plan on running a webserver, security should be one of your primary concerns.

Dogtree 23 Posting Whiz in Training

The last post was 05-11-2004 06:51 PM, over a year ago. Somehow I don't think bryj3 will have saved the code, even if he still hangs around here and sees your post.

Dogtree 23 Posting Whiz in Training

The more protection the better, in my opinon, especially if you're using an "always on" broadband connection, and even more so if you have a static IP. You can set up your router's firewall through the browser interface, usually by opening your web browser and punching in the address of your router (192.168.1.1 is a common router address for subnets).

>>Is it that one needs both hardware & software firewalls?
All you need is a hardware firewall if it's an actual hardware firewall and not a router with firewall support. If you don't have a "real" hardware firewall then a good software firewall to supplement the router firewall is a good idea.

Dogtree 23 Posting Whiz in Training

You can call an external program with the system() function:

#include <stdlib.h>

system("DIR");

But that's probably not what you want since you need the output. In that case, you need to create a pipe either through the Win32 API, or with a compiler extension if supported. For example, on Visual C++ .NET you would use SetCurrentDirectory to change the current working directory to the one you want, then _popen to create a pipe to the DIR program. After that it's just a matter of reading the FILE pointer returned by _popen just like any other stream:

#include <stdio.h>
#include <windows.h>

int main(void)
{
  FILE *fp;

  SetCurrentDirectory("C:\\");

  fp = _popen("DIR", "r");

  if (fp != NULL) {
    char buffer[BUFSIZ];

    while (fgets(buffer, sizeof buffer, fp) != NULL)
      fputs(buffer, stdout);
  }

  return 0;
}
Dogtree 23 Posting Whiz in Training

Howdy, I'm an IT professional for a seafood distribution corporation. My hobby/obssession is programming with C and C++, so I'll probably hang around there most of the time. The IRC channel is also a cool place, so expect to see me there too. :)

Dogtree 23 Posting Whiz in Training

A much safer way to get an array of strings is with the standard vector and string classes:

#include <iostream>
#include <string>
#include <vector>

int main()
{
  std::vector<std::string> a;

  a.push_back("qwerty");
  std::cout<< a[0] <<std::endl;
}
Dogtree 23 Posting Whiz in Training

>>1, who can tell me the defference between "cerr" and "cout"?
cerr is effectively unbuffered, where the stream is flushed after every output operation. cout is not required to do this.

>>7/0 is wrong,but I will let the codes continue, that is , let the result of 7/3 output.
That's a quality of implementation issue. I get a compile-time error for that code. The following code compiles for me because the divide-by-zero error doesn't involve just compile-time constants, but it crashes when trying to divide by zero:

#include <iostream>

int main()
{
  int x = 0;

  std::cout << 7/2 << " " << 7/x << " " << 7/3;
}

>>3, who can tell me the defference between exit(0) and exit(1), and what about abort()?
The value you pass to exit() will be used basically the same as if you returned that value from main:

exit(0) == return 0 // from main
exit(1) == return 1 // from main

The difference between exit(0) and exit(1) is that exit(0) is portable while exit(1) is not. Any value except for 0 and the macros EXIT_SUCCESS/EXIT_FAILURE defined in <cstdlib> has an implementation-defined meaning. Any value except for 0 and EXIT_SUCCESS means failure, but exactly what kind of failure depends on the system you're using.

>>I can't quite understand what the explaination on MSDN
I've come to the conclusion that MSDN tries to be cryptic. ;)

Dogtree 23 Posting Whiz in Training

If I recall correctly, mingw doesn't support curses "out of the box". You can download and install PDcurses from http://pdcurses.sourceforge.net/. Or if you still want to use getch outside of the curses library, this might work for you:

#include <conio.h> /* Or whatever header getch may be defined in */
#include <ctype.h>
#include <stdio.h>

enum {
  UP = 72,
  LT = 75,
  RT = 77,
  DN = 80,
};

int keycode(int c)
{
  return (c == 0 || c == 224) ? getch() : c;
}

int main(void)
{
  int c;

  while ((c = getch()) != '\r') {
    switch (keycode(c)) {
      case UP: puts("Up"); break;
      case DN: puts("Down"); break;
      case LT: puts("Left"); break;
      case RT: puts("Right"); break;
      default: 
        if (isprint(c))
          printf("%c\n", c);
        else
          printf("%d\n", c);
    }
  }

  return 0;
}

If your compiler doesn't support getch, you have to write it yourself. Here's a Unix version using termios:

#include <stdio.h> 
#include <termios.h> 
#include <unistd.h> 

int getch(void) 
{
  int c;
  struct termios old, new;
  
  tcgetattr(STDIN_FILENO, &old);
  new = old;
  new.c_lflag &= ~(ICANON | ECHO);
  tcsetattr(STDIN_FILENO, TCSANOW, &new);
  c = getchar();
  tcsetattr(STDIN_FILENO, TCSANOW, &old);
  
  return c;
}