Forum: C Jun 17th, 2006 |
| Replies: 8 Views: 2,605 I tried #1, still got 0.0.0.0 with it.. As far as #2, the issue is that I want to know what machine it is, so I don't know what to ping (and in any case, there's no need for me to ping it, since if... |
Forum: C Jun 16th, 2006 |
| Replies: 8 Views: 2,605 jim,
I'm a bit confused. If the client attempts to do a 'bind', won't it get an error that it's already in use? |
Forum: C Jun 16th, 2006 |
| Replies: 8 Views: 2,605 There's plenty of stuff before it and after, but I figured all I needed to show was the accept. (Since the socket is working fine, just thought it was how I was printing or accessing the sin_addr... |
Forum: C Jun 16th, 2006 |
| Replies: 8 Views: 2,605 Hi,
I've inherited some code in C that acts as a server and receives requests over a socket. That is all working fine. I wanted to make a very small change to the server code to print out the... |
Forum: C Apr 14th, 2006 |
| Replies: 2 Views: 1,355 Show us the code where you are requesting and accepting the string to begin with, then we'll show you how to modify it for the error checking. |
Forum: C Apr 13th, 2006 |
| Replies: 3 Views: 9,879 if x is 6 and y is 2, then the result is 0. |
Forum: C Mar 17th, 2006 |
| Replies: 3 Views: 6,368 If you want to make sure there are no numbers in a string, you can do a find_first_of( "01234567890"). If it equals anything other than string::npos, it's got a number in there. |
Forum: C Mar 15th, 2006 |
| Replies: 14 Views: 2,352 |
Forum: C Mar 13th, 2006 |
| Replies: 4 Views: 1,366 I guess the main question I have is how to define a variable that is not shared among threads inside a function that is used by a thread... |
Forum: C Mar 13th, 2006 |
| Replies: 4 Views: 1,366 I figured out a way to do it, just not sure if it's the right way. Let me know what you guys think:
Temp.cpp
extern "C"
{
#include "pthread.h"
#include "Thread.h"
}
#include <iostream>... |
Forum: C Mar 13th, 2006 |
| Replies: 4 Views: 1,366 I modified Thread.h to add the pthread_self() which shows which thread id it has...
#include "stdio.h"
#include "Temp.h"
pthread_mutex_t ilock;
void * myTest(void * arg)
{
char * test =... |
Forum: C Mar 13th, 2006 |
| Replies: 4 Views: 1,366 Hi Guys,
So I'm trying to experiment with threads, though I'm running into some problems. Basically I'm trying to create multiple threads, where each thread is passed a different set of data. In... |
Forum: C Mar 10th, 2006 |
| Replies: 7 Views: 17,212 Faced with the choice of code and no question vs. a question with no code, I prefer the former... ;) |
Forum: C Mar 5th, 2006 |
| Replies: 1 Views: 2,669 I was able to figure it out by doing 'man lfcompile', which told me about 'getconf'. I then ran getconf LFS_CFLAGS and got
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
Once I compiled with these... |
Forum: C Mar 5th, 2006 |
| Replies: 1 Views: 2,669 I am trying to write a large file, but it always stops writing when it hits 2GB. (2147483647 bytes to be exact). I know it's not an O/S or disk issue (I'm on solaris) as I'm able to use the mkfile... |
Forum: C Feb 26th, 2006 |
| Replies: 17 Views: 3,111 I claim no credit, it's one of daniweb's choices... |
Forum: C Feb 26th, 2006 |
| Replies: 17 Views: 3,111 Try this one out:
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string numerator;
string denominator;
string myNum; |
Forum: C Feb 26th, 2006 |
| Replies: 17 Views: 3,111 vicky_dev,
I'm still not sure what you want in terms of an answer. Is it basically 2 numbers that when divided end up with your original value? (ie 433 % 100 = 4.33?) |
Forum: C Feb 25th, 2006 |
| Replies: 17 Views: 3,111 I'm probably missing some math aspect here, but couldn't you convert 4.33 to a string, find out what position the . is and have your answer? |
Forum: C Feb 24th, 2006 |
| Replies: 2 Views: 1,013 Is there a function that I can use that given a few vectors which elements are common to all?
for example
vector<int> a;
vector<int> b;
a.push_back( 1 );
a.push_back( 2 );
a.push_back( 3... |
Forum: C Feb 15th, 2006 |
| Replies: 12 Views: 6,592 Also,
What's the command line you are using to run it? |
Forum: C Jan 19th, 2006 |
| Replies: 4 Views: 1,258 Can you provide more code? (Also, calling atof for a double maybe a bad idea - losing precision/etc). |
Forum: C Jan 17th, 2006 |
| Replies: 3 Views: 2,859 need () around if:
if ( any == 0 )
also, you want == not = |
Forum: C Jan 5th, 2006 |
| Replies: 3 Views: 1,349 There's also sprintf and using iostringstream. All depends on language, preference, and context. |
Forum: C Dec 29th, 2005 |
| Replies: 6 Views: 1,756 Now the next step is to make the user pass in a year at the command line, etc. |
Forum: C Dec 29th, 2005 |
| Replies: 6 Views: 1,756 Too lazy - here's the corrected code:
#include <stdio.h>
int main (int argc, char * argv[])
{
switch (1066)
{
case 1066:
printf( "Battle of Hastings\n");
break; |
Forum: C Dec 29th, 2005 |
| Replies: 6 Views: 1,756 Why is main commented out? and after you comment it out, why does it have a semicolon? And why are there no colons after each case statement? And why is default spelled wrong? |
Forum: C Dec 20th, 2005 |
| Replies: 7 Views: 1,794 See this - you can by using pointers.
http://www.eskimo.com/~scs/C-faq/q4.11.html |
Forum: C Dec 18th, 2005 |
| Replies: 7 Views: 1,794 It all depends upon how the functions are defined. Look up 'passing by value' vs. 'passing by reference'.
not all functions return a value. Any function defined as such:
void functionName() or... |
Forum: C Dec 16th, 2005 |
| Replies: 4 Views: 1,590 What's the point of this statement? You don't return something else instead and you don't perform any logic...
if ((index < 1) || (index > size())){
// can't retrieve something that isn't there... |
Forum: C Dec 15th, 2005 |
| Replies: 4 Views: 1,590 Is it just a typo in the post or is the object called Patient with a capital P and the class methods are using patient with a lowercase p? |
Forum: C Dec 9th, 2005 |
| Replies: 18 Views: 2,353 again, print out ch inside the default: of the switch. |
Forum: C Dec 9th, 2005 |
| Replies: 18 Views: 2,353 For the switch, print something out in the default (for example, print out the value of ch to see what value was passed...) |
Forum: C Dec 5th, 2005 |
| Replies: 5 Views: 1,843 NO - you missed my point - I meant when RUNNING the program, not the code for example. Instead of:
MyProg this is my path this is my file.txt
you should run:
MyProg "this is my path"... |
Forum: C Dec 4th, 2005 |
| Replies: 5 Views: 1,843 Does your filename or path contain a space? If so, make sure to pass it inside double quotes... |
Forum: C Nov 13th, 2005 |
| Replies: 6 Views: 2,361 Basically, you're going to have to post your existing code to show that you've put in some effort. |
Forum: C Nov 12th, 2005 |
| Replies: 15 Views: 3,003 It's not just windows - I believe AIX is the same way. |
Forum: C Nov 11th, 2005 |
| Replies: 8 Views: 2,871 In my opinion, this is a pretty silly request - in any case, tell us the headers you've already included so we can come up with a way given the methods already provided. |
Forum: C Oct 23rd, 2005 |
| Replies: 3 Views: 2,271 Yes, just look at the other members of the tm struct. |
Forum: C Oct 5th, 2005 |
| Replies: 2 Views: 1,177 I'm using doubles for now (fmod is working nicely). Thanks. |