Forum: C++ Apr 9th, 2007 |
| Replies: 3 Views: 13,271 Is there any way to read or write to a socket besides using the read() and write() functions. Is there any way to treat it like a stream and use the insertion/extraction operators (<< and >>)? The... |
Forum: C++ Apr 2nd, 2007 |
| Replies: 1 Views: 800 I'm trying to create a general buffer that I can use in my program. It will work with ints as well as strings. So far I've been using a strstream, and it works without a hitch, but I was wondering if... |
Forum: C++ Feb 14th, 2007 |
| Replies: 4 Views: 7,642 I found out the problem. It waits because it wants another program to handle the other end of the pipe.
I fixed my codes up and I wrote a script like this to fix the problem:
#!/bin/bash... |
Forum: C++ Feb 13th, 2007 |
| Replies: 4 Views: 7,642 Hi,
I'm trying to write a program using named pipes, and I'm having trouble opening it. In another program I call this line:
mkfifo("./fife", 0777);
So my named pipe exists and I see it... |
Forum: C++ Nov 20th, 2006 |
| Replies: 10 Views: 4,629 If you want to connect to your own network by going outside and coming back in you need to know your external IP address, and you need to tell your router to forward your port(1234) to your server... |
Forum: C++ Nov 18th, 2006 |
| Replies: 6 Views: 4,570 This code snippet actually contains a few nifty things. There are two functions, hasVisited() and main(). hasVisited() makes use of a very handy function for CGI programmers: getenv. You can see I... |
Forum: C++ Nov 11th, 2006 |
| Replies: 14 Views: 2,665 s.o.s.
Thanks for the clarification. I noticed that his was default initialized to 0 so i thought maybe it depended on the compiler. Now I know it only does that with global variables. |
Forum: C++ Nov 10th, 2006 |
| Replies: 14 Views: 2,665 Hey,
In your printshippos function, you declare checkFlag at the top of that cpp file. When you initialize it like that w/o any number, it is either an unknown number, or in most cases, 0. The... |
Forum: C++ Nov 10th, 2006 |
| Replies: 14 Views: 2,665 hey, would you mind posting your code of sending me your code? I'd like to see your working code just so I can study it. |
Forum: C++ Nov 9th, 2006 |
| Replies: 14 Views: 2,665 I noticed too that you declare shippos inside an if block { } and try to refer to it in the next if statement, which is in a different block of code. That is probably why it prints out as 0+228... |
Forum: C++ Nov 9th, 2006 |
| Replies: 14 Views: 2,665 Here is a link that might help you.
http://www.functionx.com/managedcpp/keywords/static.htm |
Forum: C++ Nov 9th, 2006 |
| Replies: 14 Views: 2,665 I think the problem is because when you declare a variable static it affects the lifetime of it. You declare it inside the If brackets { }, so it will be destroyed at the end of the if statement.... |
Forum: C++ Nov 9th, 2006 |
| Replies: 10 Views: 1,736 I compiled your latter source code, and it worked fine. I could input the four numbers and it would give me output. You say it quits before it outputs the text? If you are using Visual Studio, if you... |
Forum: C++ Nov 7th, 2006 |
| Replies: 2 Views: 1,247 I have a question and I was hoping someone could point me in the right direction.
I know the IP address of a server I want to download a file from, and I know the path on the client hard disk I... |
Forum: C++ Nov 4th, 2006 |
| Replies: 17 Views: 2,712 I am a college student right now and I do almost all of my school coding with JOE on linux systems and compile with g++. I've also had to use Visual Studio 2003, which did make it easy to debug. I... |
Forum: C++ Nov 1st, 2006 |
| Replies: 11 Views: 2,956 Ok, so I tried everything I could think of and tried everyone's suggestions. Finally, I just put it all into my main cpp file. It looks like this:
#include <iostream>
#include <vector>
class... |
Forum: C++ Nov 1st, 2006 |
| Replies: 7 Views: 6,011 I like this snippet. I always find this kind of C++ code very useful. |
Forum: C++ Nov 1st, 2006 |
| Replies: 11 Views: 2,956 Alright, I read the page a few times, and tested a few things and still I was frustrated. I decided to do away with the templates, because in my case I am only going to use it for int. I simplified... |
Forum: C++ Oct 31st, 2006 |
| Replies: 11 Views: 2,956 I did try it, but no luck :sad: same errors. |
Forum: C++ Oct 31st, 2006 |
| Replies: 11 Views: 2,956 Can I combine Queue.h and Queue.cpp into one file? I tried it, but I still get errors, so I'm not sure if that is allowed. |
Forum: C++ Oct 31st, 2006 |
| Replies: 11 Views: 2,956 Hi,
I'm trying to write a simple Queue class, but I'm having trouble using it. It tells me I have undefined references to the functions I call in main.
// main.cpp
#include <iostream>... |
Forum: C++ Oct 1st, 2006 |
| Replies: 1 Views: 1,486 When someone accesses a cgi script in their web browser is there a way to gather information, like IP address or user's web browser? I know how to read command line arguments, but I have a feeling... |
Forum: C++ Oct 1st, 2006 |
| Replies: 7 Views: 3,025 Ok, for anyone interested, this is the entire mergesort program I was working on. It is finished and works(w/ g++). The stringstream issues I had were in the "GetInput" function. You will see how I... |
Forum: C++ Oct 1st, 2006 |
| Replies: 7 Views: 3,025 Sorry for misunderstanding it. I got the problems all worked out now. Thank you all. =) |
Forum: C++ Oct 1st, 2006 |
| Replies: 7 Views: 3,025 Thank all of you for your help,
I took all of your suggestions into account and made some changes in my code. Ancient Dragon, I took your advice on the string, which I think is more appropriate... |
Forum: C++ Oct 1st, 2006 |
| Replies: 7 Views: 3,025 Ok, I have a small problem. I'm just trying to get my program to read a single line from a file at a time, and put the results in a vector.
The problem is at the end of each vector. It repeats the... |
Forum: C++ Sep 29th, 2006 |
| Replies: 1 Views: 2,503 Hi everyone,
I have a simple setback in my program. I'm not the best way to go about doing this. I'm trying to do it in the simplest way possible. I have an input file that looks like this
2.5... |
Forum: C++ Jun 12th, 2006 |
| Replies: 14 Views: 3,326 I have been writing some CGI scripts in C++, and I was wondering if anyone else has done the same? I have built a pretty decent sized library of functions I use a lot for formatting form inputs and... |
Forum: C++ Jun 6th, 2006 |
| Replies: 3 Views: 9,897 This is a code snippet I wrote about keyboard input. It includes a demonstration of the arrow keys being read.
http://www.daniweb.com/code/snippet497.html |
Forum: C++ Jun 4th, 2006 |
| Replies: 3 Views: 1,099 WolfPack is correct if you want to put the name of the file into your code. From the post, I read that you wanted to pipe a file into it. It would help if you posted your operating system. This is... |
Forum: C++ Jun 1st, 2006 |
| Replies: 4 Views: 2,467 I'd like to add something (in case anyone is interested). An issue with the code I previously posted was that if there was a lot of time between calls to kbhit() and you only used one call to getch()... |
Forum: C++ Jun 1st, 2006 |
| Replies: 4 Views: 2,467 Narue,
I looked up kbhit() and I read that it typically was a Borland Turbo C++ thing. Sure enough though, MS Visual Studio 2005 has a _kbhit(). It worked like a charm! The thing is, kbhit()... |
Forum: C++ Jun 1st, 2006 |
| Replies: 4 Views: 2,467 I've been trying to solve this problem for a while now with no luck. I want to monitor an input buffer(cin) for a keypress. The catch is, I don't want it to hang if the buffer is empty. getch() and... |
Forum: C++ May 25th, 2006 |
| Replies: 12 Views: 7,603 Hey zellex,
I wrote a connect 4 AI agent a while ago. You can play it at
http://students.csci.unt.edu/~jdl0107/conn4.exe
I know our code is different, but this is a link to my source code... |
Forum: C++ May 24th, 2006 |
| Replies: 5 Views: 2,754 Mr. Sinkula:
Actually, I put the #define after the include statements. I moved it to before the includes, and it worked! I guess I thought that it would be better after the includes, that way it... |
Forum: C++ May 24th, 2006 |
| Replies: 5 Views: 2,754 I'm writing a Win32 application for Windows XP with Visual Studio 2005. It is a console program, and I'm trying to find the HWND attribute of my console. I need this because I need to use it as a... |
Forum: C++ May 23rd, 2006 |
| Replies: 2 Views: 1,005 Hey everyone,
I'm trying to write a simple program that can do more than one thing at once. I'm not an expert on the iostreams, so I don't know if I need to create threads to accomplish what I... |
Forum: C++ May 19th, 2006 |
| Replies: 1 Views: 4,641 Hey,
I have a problem using Visual Studio 2005. In the MSDN library it says there is a function called SetConsoleDisplayMode. This function though is not in the 2005 library. I'm assuming... |
Forum: C++ May 17th, 2006 |
| Replies: 4 Views: 999 Well, I'm not sure about everything you need to do in the program but there are a few things I noticed.
As the other reply says, your loop for the array should go from 0-4, not 1-5.
After all... |
Forum: C++ May 16th, 2006 |
| Replies: 9 Views: 6,846 A good way of finding the highest of X number of integers is to use vectors, and to use the sort algorithm. They are both from the Standard Template Library STL. I'll give you an example of how to... |