1,494 Posted Topics

Member Avatar for wschamps42

The return value of fork() will explain your questions RETURN VALUE On success, the PID of the child process is returned in the parent, and 0 is returned in the child. On failure, -1 is returned in the parent, no child process is created, and errno is set appropriately.

Member Avatar for np complete
0
188
Member Avatar for michelle1
Member Avatar for veledrom

Because Perl has so many esoteric built-in variables like - @_ or $_ or $. or $` or $& or $' or $^I...it can make the code very messy(like line noise) to the uninitiated .

Member Avatar for Rashakil Fol
0
165
Member Avatar for daffi_gusti

I'm not sure what your trying to accomplish here...Do you want to read each character and display it on its own line? I quickly wrote this. It will output the characters like you posted [code] #include <stdio.h> #include <stdlib.h> int main(int argc, char**argv) { char ca; FILE *fd; if (!(fd …

Member Avatar for Sokurenko
0
4K
Member Avatar for jcmeyer

Its been some time since I did any SQL but won't it be a more natural fit to use UPDATE WHERE to update a record

Member Avatar for webstart
0
222
Member Avatar for hypernova
Member Avatar for hypernova
0
261
Member Avatar for TarkiB

Number one. If your passing a pointer to an array then your function should accept a pointer to an array. int listrented(cars_t * cars2) { printf("Testing...\n"); /*shoud return something here*/ } Number two. When you call a function, you don't declare the varibles > if(choice == 3) listrented(cars_t cars[]); /*should …

Member Avatar for TarkiB
0
3K
Member Avatar for hwoarang69

A pointer is just a variable, so coping a pointer into a pointer is done just like you showed. char *name1; char *name2; name2 = name1; Now both name2 and name1 point to the same memory area.

Member Avatar for Shardendu
0
177
Member Avatar for freddyk

It doesn't matter, its just uninitialized memory. Why do you think its a memory pointer? It could just as easily be a signed/unsigned interger...Memory is not self defining, its whatever we(the program) say it is.

Member Avatar for rubberman
0
163
Member Avatar for gerard4143

I have a question about istream iterators and reading the input to the EOL. How do you do it? I tried the following but had to revert to a hack to get it to work. My first attempt reads from the istream but a word at a time. first.cpp #include …

Member Avatar for gerard4143
0
354
Member Avatar for vedro-compota

Triy this link on va_arg http://www.cplusplus.com/reference/clibrary/cstdarg/va_arg/

Member Avatar for vedro-compota
0
181
Member Avatar for thorpntell

On line 27 you have a semi-colon else if (s[n] == 12); { I think that's your problem

Member Avatar for scudzilla
0
4K
Member Avatar for jiggaman77777

I think you should use a for statement to loop through your myArr array, comparing each element to the calculated average.

Member Avatar for ravenous
0
2K
Member Avatar for poolet

Maybe, in advance, you could give us a brief description of what the code is supposed to do.

Member Avatar for poolet
0
238
Member Avatar for gerard4143
Member Avatar for doma18
Member Avatar for doma18
0
146
Member Avatar for A_Dubbs

If I understand this you have the hard part all figured out. Just prompt for the numbers in your for loop and add them up and the divide by the total

Member Avatar for B dawg
0
941
Member Avatar for balajirs

Well the first thing you'll have to do is determine page size on your computer. Then you could try something like below. [code] #include <stdio.h> #include <stdlib.h> #define MY_PAGE_SIZE 4096 int main(int argc, char** argv) { unsigned long addr = (unsigned long)&main & ((0UL - 1UL) ^ (MY_PAGE_SIZE - 1)); …

Member Avatar for gerard4143
0
746
Member Avatar for chirag_mittal

The error message tells it all. The case needs to be a constant...Like 1,2,3,4,5...or [code] #define one 1 const unsigned long two 2; switch(angle) { case:1 {} case:two {} } [/code]

Member Avatar for chirag_mittal
0
469
Member Avatar for dellat
Member Avatar for gunnerone

Wow I won't be forking a process that's already sporting an extra thread(the event loop).

Member Avatar for gerard4143
0
199
Member Avatar for karoma

Just use [code] struct mys {}; struct mys * pointer = (struct mys*)malloc(num_elements * sizeof(struct mys)); [/code]

Member Avatar for death_oclock
0
225
Member Avatar for Johnathon332

Because goto can have devastating results on your program and program flow its frowned on. If you really need to jump all over your program try a safe function like longjmp(). [code] void longjmp (jmp_buf env, int val); int setjmp ( jmp_buf env ); [/code]

Member Avatar for mike_2000_17
0
189
Member Avatar for c++ lover

It really depends on your extraction criteria but I would start investigating functions like strtok().

Member Avatar for zeroliken
0
80
Member Avatar for JC11
Member Avatar for tahir696
Member Avatar for gerard4143
0
33
Member Avatar for nitigya92
Member Avatar for Suzie999
Member Avatar for Suzie999
0
901
Member Avatar for foreshadowed

Try defining your function like so: [code] void initFoo(foo **tmp) { ... *tmp = malloc(sizeof(foo) * 5); ... } [/code] and pass the pointer like so [code] foo *bar = NULL; /* want to create an array of 5 */ initFoo(&bar); [/code]

Member Avatar for MonsieurPointer
0
149
Member Avatar for jdm

Sure we'll help. What's your question or problem? Well besides its not working.

Member Avatar for gerard4143
0
262
Member Avatar for man0987
Member Avatar for Tumlee
0
201
Member Avatar for sinrtb

[QUOTE=Jimmeny;1771865]borland c++ is fastest[/QUOTE] Why do people keep reviving these old threads?

Member Avatar for Jimmeny
0
435
Member Avatar for Suzie999

You could use the static keyword but I would create the array on the heap. [code] int* Bar(){ int * array = new int[2]; array[0] = 1; array[1] = 2; return array; } [/code] Just remember that you have to track and maybe delete [] this array.

Member Avatar for Suzie999
0
129
Member Avatar for jimmyraay
Member Avatar for livinFuture
0
288
Member Avatar for phummon

I tried this and my compiler didn't complain. [code] #include <iostream> #include <vector> #include <string> using namespace std; class GameUnit { public: string GetName() {return Name;} protected: string Name; }; class Player { public: void ListUnits(); protected: vector<GameUnit*> MyUnits; }; void Player::ListUnits() { for(unsigned int i=0; i<MyUnits.size(); i++) { cout<<MyUnits[i]->GetName()<<"\n"; …

Member Avatar for phummon
0
257
Member Avatar for varunrathi

[QUOTE=resat.1907;1769791]Integer size is generally 4 bytes however char is only 1 byte your error is caused by thisissue in my opinion[/QUOTE] You realize this thread is 8 years old.

Member Avatar for gerard4143
0
1K
Member Avatar for sridhar.selva
Member Avatar for gerard4143

Is it possible to pass a map container to the copy algorithm and display it to the std::cout? If so how? What I tried below doesn't work but it looks like it should. Any comments or pointers will be appreciated. [code] #include <iostream> #include <string> #include <map> #include <algorithm> #include …

Member Avatar for gerard4143
0
366
Member Avatar for Sohvkhan
Member Avatar for subith86

Yes, I'm surprised your compiler allowed it. The assignment operator must return a reference to the object.

Member Avatar for subith86
0
135
Member Avatar for kristen237
Member Avatar for PrimePackster
0
209
Member Avatar for jackmaverick1
Member Avatar for chuyauchi
Member Avatar for rithish

[QUOTE=rithish;1767955][CODE]#include<stdio.h> struct rec { int i; float PI; char A; }; int main() { struct rec *ptr_one; ptr_one =(struct rec *) malloc (sizeof(struct rec)); ptr_one->i = 10; ptr_one->PI = 3.14; ptr_one->A = 'a'; printf("First value: %d\n", ptr_one->i); printf("Second value: %f\n", ptr_one->PI); printf("Third value: %c\n", ptr_one->A); free(ptr_one); return 0; } [/CODE] …

Member Avatar for deceptikon
0
116
Member Avatar for MrEARTHSHAcKER

Sounds like your using unsigned characters for one and signed characters for the other.

Member Avatar for MrEARTHSHAcKER
0
176
Member Avatar for eranga246
Member Avatar for prasenjit_das

Look up arbitrary precision arithmetic libraries like [url]http://gmplib.org/[/url]

Member Avatar for jmichae3
0
235
Member Avatar for wildplace

start_routine is the entrance point of the thread create with pthread_create.

Member Avatar for mike_2000_17
0
94
Member Avatar for SDDMV
Member Avatar for rucafe

[quote] When I try to this, it will only print the first character of the particle name... [/quote] That's because your scanning a character [code] sscanf(line.c_str(), "%c %c %f %f %f %f %f", &(current_step.m_plus), &(current_step.m_particle), &(current_step.m_energy_sec), &(current_step.m_xpos_sec), &(current_step.m_ypos_sec), &(current_step.m_zpos_sec)); [/code] In you format string the second specifier is %c which …

Member Avatar for gerard4143
0
196

The End.