- Upvotes Received
- 12
- Posts with Upvotes
- 12
- Upvoting Members
- 1
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 2
13 Posted Topics
Hi Guys, I have a question on C++ object creation. Please consider the following code snippet. [code] class Foo { private: int i; public: A(int ii):i(ii) {}; }; int main() { const Foo &ref = Foo(1); } [/code] Here I am bit confused about the line : const Foo &ref … | |
[code] Can anybody please tell me how to calculate/find total remaining(unused/free) memory in the system(using any functions)? Thanks Iqbal [/code] | |
Hi All, I am struck with following problem. Please help me out. I have defined a Oracle procedure as follows. [code] PROCEDURE JOB_EXPORT IS cur CWTYPES.cursorType; l_nextdate DATE; -- JOB_NEXT_RUN l_interval VARCHAR2(64); BEGIN OPEN cur FOR SELECT JOB_NEXT_RUN, JOB_INTERVAL FROM JOB_EXPORT_CDRS WHERE ACTIVE_STATUS=1 AND JOB_INTERVAL IS NOT NULL LOOP FETCH … | |
Hi All, I have a doubt regarding "threadsafe". Consider the following scenario.... [inlinecode] Thread #1: fun1() { lock(); writestring(ptr, pconfig); unlock(); } Thread #1: fun2() { lock(); writestring(ptr, pconfig); unlock(); } bool writestring(char *ptr, char *pconfig) { //this code should not be shared across threads. One thread should access at … | |
Hi All, I have built an application on C++. It is a multi threaded application. My application spawns 8 threads when it come up. Each thread opens one file and maps it using mmap. It is a client-server application. Each thread picks up a message from the queue and processes … | |
The following is the core dump got from the application crash(just took a line from the core dumped file). [code] 003af9dc memcpy (0, 0, 4629e8, 4629e8, 0, fbc06e65) + e8 [/code] I could not understand what it is trying to say here. As memcpy takes three parameters, here it is … | |
[code] #include<iostream> using namespace std; class test { public: void display() const { cout<<"Hai Here in class"<<endl; } }; int main() { const test b; b.display(); } [/code] When I execute the above code I got an error saying "uninitialized const b". But if I provide a default constructor it … | |
When I compiled the follwing code snippet, it compiled without any error. My question is if it is allowed to declare [I]char[/I] fields inside a structure, then how can I store character string in that variable(we can not use functoins like strcpy:-| ). OR Is it not allowed to declare … | |
Re: You can refer the following code if you would like to.... [code] #include<stdio.h> #include<stdlib.h> #include<string.h> int main () { char host[] = "[URL="http://www.google.com"]www.google.com[/URL]"; char delim[]="."; int i=0, index=0; char *token; char buf[100]; char len_char; int length; token = strtok(host, delim); buf[0]='\0'; while (token != NULL) { length = strlen(token); sprintf(buf+strlen(buf), … | |
I have a doubt on function returning a value. Consider the following program snippet. [code] int add(int a,int b) { int c=a+b; return; } int main() { int a=10,b=20; printf("%d %d %d",a,b,add(a,b)); return(0); } [/code] The above program gives the output as 10 20 30 But the function is not … | |
Re: [quote=andor;251183]To allocate two dimensional arrays [code] #include <stdlib.h> #include <stdio.h> int main() { int ** array, i; array = calloc(256, sizeof(int)); if (array == NULL) { printf("No mem!\n"); return 1; } for (i=0; i<256; i++) { array[i] = calloc(256, sizeof(int)); if (array[i] == NULL) { printf("No mem!\n"); return 1; } … | |
[code] Please look at the following code snippets: char str[]="abcd"; // Gets stored in stack frame. char *str="abcd"; // Where does this gets stored? In case of first declaration ie char str[]="abcd"; the string "abcd" gets stored in the stack frame of the invoked funciton. I wonder where does the … | |
It is not allowed to declare a variable of same structure type but it is allowed to declare a pointer. For example, [code] struct node { int a; struct node x; //not allowed struct node *pnext; //allowed }; [/code] My question is when we can declare a pointer of same … |
The End.