1,494 Posted Topics

Member Avatar for shinsengumi

Any exec function replaces the calling image with its own..So that would explain why the calling process closes... If I was doing this, I would use the fork/exec combination.

Member Avatar for shinsengumi
0
200
Member Avatar for MarounMaroun

Try this one [code] MyMatrix‬‬: MyMatrix.o MyStringMain gcc MyMatrix.o -o MyMatrix MyMatrix.o: MyMatrix.c gcc -c MyMatrix.c MyStringMain: MyString.o MyStringMain.o gcc MyString.o MyStringMain.o -o MyString -o MyStringRun MyStringMain.o: MyStringMain.c MyString.c MyString.h gcc -c MyStringMain.c MyString.o: MyString.c MyString.h gcc -c MyString.c .PHONY:clean clean: rm -f *.o test.out [/code]

Member Avatar for MarounMaroun
0
313
Member Avatar for xyz1987

Why would you be searching for an address in a range? You already know the address right? Are you searching for a value that may be stored in a range of addresses?

Member Avatar for gerard4143
0
74
Member Avatar for MasterGberry

Your function call with char * maxStr = maxn(str, 5); Does it make sense to have str[i].size(); since str[i] is a c-string?

Member Avatar for MasterGberry
0
103
Member Avatar for makingafire

In C++ day = 'p' is the assignment operator not the comparison operator...You want day == 'p' See line 57

Member Avatar for gerard4143
0
112
Member Avatar for apbarratt

Firstly char* test = "ABC" creates a read only c-string so you can't modify it... You want something like char test[10] = {'A','B','C','\0'};

Member Avatar for apbarratt
0
187
Member Avatar for NichtSoGut

See if you can find what I changed... [code] #include <stdio.h> int NumericalAnswer; int score = 0; int main() { printf("Question 1: What's 4 x 3?\n"); scanf("%d", &NumericalAnswer); if (NumericalAnswer == 12) { printf("You got it right!"); score += 1; } return 0; } [/code]

Member Avatar for Narue
0
115
Member Avatar for atramposch

A few things...First what doesn't work? Next you should check to see if fopen was successful. dblPoint = fopen(BINDATA, "wb"); Did fopen succeed or fail here?

Member Avatar for Ancient Dragon
0
169
Member Avatar for dduleep

Because its syntactically illegal. Check this link... [url]http://www.neu.edu.cn/cxsj/materal/otherc/imada/subsection3_6_2.html[/url]

Member Avatar for Jmknight
0
105
Member Avatar for Hayzam_#include
Member Avatar for foobar8

What is this out(client_fd, string, readcount); Ooops, found your posted code.. You could help us out with a few remarks in your code...Also I noticed many malloc's char* string = malloc(BUFLEN); But no free's.

Member Avatar for mrropi
0
945
Member Avatar for dancks

"I heard in class that dynamic arrays like in java aren't supported" Hmmmm, yes they are. Try a vector.

Member Avatar for Fbody
0
185
Member Avatar for onus

To see what's just do some substitution... #define TBASE_DEFERRABLE_FLAG (0x1) struct tvec_base *base First we cast base to unsigned long (unsigned long)base Then we perform the bit operation & on (unsigned long)base & 0x1 Then we cast our result to (unsigned long)(unsigned long)base & 0x1 Why do it this way? …

Member Avatar for onus
0
166
Member Avatar for medamineb

First question. What is t[] an array of, characters? I ask because you pass 1 as the size in your write function. Second question...You have int val; read(fd[0],&val,1); val is an integer...its size should be sizeof(int)...e.g. read(fd[0], &val, sizeof(int)); Third question...Well more of a pointer write(fd[1],t[i],1); should be write(fd[1],&t[i],sizeof(whatever t …

Member Avatar for medamineb
0
1K
Member Avatar for oggiemc

I see one potential problem here. You have a forward declaration class Retriever..Which makes me wonder??? If you have a Alsation object and call your friend function which has a reference to a Retriever how do you intend to handle the fact that your data members may deficient for a …

Member Avatar for mike_2000_17
0
159
Member Avatar for yuri1969

The easiest way is the functionality in the XDR library(eXternal Data Represention) or if your not familiar then you could pass non c-string data by passing the start address and the length...Like this. [code] unsigned int mydata = 1234; write(clientfd, &mydata, sizeof(mydata)); [/code] Please note, you cannot pass pointers and …

Member Avatar for yuri1969
0
176
Member Avatar for muramasa007

The biggest thing that I see is line 30 you call calcData() but downpayment, mort_gage, loan are uninitialized..

Member Avatar for muramasa007
0
134
Member Avatar for manofhouse

I only quickly looked at your code...I couldn't find a != operator for decimal.

Member Avatar for gerard4143
0
192
Member Avatar for TGeorge824

If this points to a structure.. process *state_of_queue = fcfs(q); Then use state_of_queue->structure_member or (*state_of_queue).structure_member

Member Avatar for TGeorge824
0
155
Member Avatar for achieve_goals

[QUOTE=achieve_goals;1386402]And also, it wont let me use getline(cin, input, '@@@'), if I try to enforce that condition. Thanks in advance.[/QUOTE] That's because the delimiter has to be a character....'@' is a character but '@@@' is not. Why did you post your C++ question in the C section?

Member Avatar for achieve_goals
0
341
Member Avatar for qvyhnl

I don't know why your allocating memory because s1 is supposed have enough room to append s2 onto it.. Here's a simple example that came with my help files [code] char* strncat(char *dest, const char *src, size_t n) { size_t dest_len = strlen(dest); size_t i; for (i = 0 ; …

Member Avatar for qvyhnl
0
98
Member Avatar for MarounMaroun

[QUOTE=MarounMaroun;1385698]Thanks [b]myk45[/b] for your help. Now, about the second question.. I don't want to allocate less of bytes, but lets say I did that.. why it won't return a segmentation fault? I just want to understand what is going on if I allocate less bytes..[/QUOTE] It probably depends on you …

Member Avatar for MarounMaroun
0
105
Member Avatar for ntgsx92

This function strcpy() expects c-strings not characters strcpy(array1[n],array[i]); array1[n] and array[i] are characters.

Member Avatar for ntgsx92
0
103
Member Avatar for rossie queen

The main thing is cout to fprintf [url]http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/[/url]

Member Avatar for gerard4143
0
353
Member Avatar for tastyTreeHUGGER

I tried compiling your code but you have MS specific functionality....scanf_s doesn't work with Linux...

Member Avatar for tastyTreeHUGGER
0
304
Member Avatar for slavacrilov

If you insist on doing it this way then try the string's [] operator. [code] int i = fullName.length(); cout<<"Your reversed full Name is: "; while (i>=0) { cout<<fullName[i]; i--; } [/code] Please note that the string object has iterators which would handle this problem nicely.

Member Avatar for slavacrilov
0
109
Member Avatar for vedel

If this is a custom environment then you'll probably have to create a special linking/compiling process so your exe will execute. In truth I'm not really sure what your after? The boot floppy, is it one you created or is it one you downloaded? The kernel I have the same …

Member Avatar for vedel
0
226
Member Avatar for berwick53

Please get out of the habit of using gets(), its a very dangerous function. A much better solution is fgets(). Also... Your while statement assumes that the fetched c-string is 80 characters long? [code] while(i!=80) [/code] shouldn't it be [code] while(i <= strlen(array)) [/code] Also this next line is incorrect …

Member Avatar for vinitmittal2008
0
158
Member Avatar for Joey_Brown
Member Avatar for smellissa
0
98
Member Avatar for vbx_wx

Because that's the size of the pointer and not the size of the c-string. Try displaying the pointer with [code] std::cout << (void*)p << std::endl; [/code]

Member Avatar for nbaztec
0
99
Member Avatar for araisbec

Line 11 and 12...should you allocate the memory for the node first before you you allocate the memory for one of its members.

Member Avatar for araisbec
0
679
Member Avatar for centerline00

'It gives me a "bad_alloc" error when the obj is instantiated.'...Which object?

Member Avatar for Fbody
0
237
Member Avatar for BLUEC0RE
Member Avatar for BLUEC0RE
0
99
Member Avatar for lakk
Member Avatar for lakk
0
115
Member Avatar for vbx_wx
Member Avatar for vinitmittal2008
0
289
Member Avatar for SpyrosMet

Two c-strings are identical if, the starting addresses are the same or if different(starting addresses) the characters that constitute the c-string are the same.

Member Avatar for Agnusmaximus
0
1K
Member Avatar for a-humam
Member Avatar for burcin erek
Member Avatar for burcin erek
0
100
Member Avatar for vedel

[QUOTE=vedel;1380775]yeah i know this tutorial and i try it out but it did not work[/QUOTE] I wrote something like this but didn't use C++, I used asm(16 bit) plus had to write my own linker script to get it to work... Projects like this are very interesting and the end …

Member Avatar for vedel
0
1K
Member Avatar for chrishtones

Do you mean, how does a C object file that has been linked into a C++ project, retrieve/accept the GUID of an object?

Member Avatar for gerard4143
0
629
Member Avatar for vbx_wx

The question is...What were you expecting? Was it something like below [code] #include <iostream> #include <cstring> using namespace std; int main(int argc, char* argv[]) { unsigned char p[] = {'1', '1', '1', '1'}; unsigned char a[4]; for(int i = 0; i < 4; i++) { a[i] = ~(p[i] - '0'); …

Member Avatar for gerard4143
0
94
Member Avatar for nk28

Try creating a small exe with the gcc compiler then use the binutil readelf -a exename It should display all the information you need..

Member Avatar for gerard4143
0
192
Member Avatar for modesto916

I'm a little confuse...Do you want a program that will take an inputted binary number and then produce its decimal equivalent? e.g. enter a binary number->111 ans->7 Is that what you want?

Member Avatar for modesto916
0
97
Member Avatar for gahhon

Do you mean how large of a value? If you do then check the limits.h library

Member Avatar for gahhon
0
6K
Member Avatar for Caeon

Number one, your defining your functions inside of main..Place them before main like [code] void print_matrix(int n, int m[n][n]); // Prints an nxn matrix void print_vector(int n, int v[n]); // Prints a vector of n elements void matrix_x_vector(int n, int y[n], int x[n][n], int A[n][n]); int main() {} [/code]

Member Avatar for Caeon
0
12K
Member Avatar for frogboy77

[QUOTE=frogboy77;1378671]thanks will have a look.[/QUOTE] You should check out the recommended C++ book's sticky [url]http://www.daniweb.com/forums/thread70096.html[/url] I've read Accelerated C++ and The C++ Standard Library A Tutorial and Reference and both are excellent books.

Member Avatar for gerard4143
0
222
Member Avatar for skiabox

Try setting up your VLA in a function call like so [code] #include <stdio.h> void myfunc(int size) { int i = 0; int mya[size]; for (i = 0; i < size; ++i) mya[i] = i + 10; for (i = 0; i < size; ++i) fprintf(stdout, "ans->%d\n", mya[i]); } int …

Member Avatar for skiabox
0
138
Member Avatar for oggiemc
Member Avatar for blogoot

[QUOTE=blogoot;1379027]linux and gcc[/QUOTE] As A.D. said you'll have to provide more info. These programs, are they on the same machine or distributed over a network? Will you be using pipes, shared memory, sockets or even possibility threads?

Member Avatar for gerard4143
0
135
Member Avatar for SpyrosMet

Why does it seg fault? Because you have to send the value that the pointer points to and not the pointer. [code] int *iptr = (int*)malloc(sizeof(int)); *iptr = 1234; /*the wrong way*/ write(sock_var, iptr, sizeof(iptr)); /*the right way*/ write(sock_var, *iptr, sizeof(int)); [/code] Note - pointers are only valid in their …

Member Avatar for SpyrosMet
0
155

The End.