Search Results

Search found 23792 results on 952 pages for 'void pointers'.

Page 22/952 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Suggestions/pointers for Post/Get to an .ASP (or .ASPX) page from a desktop app

    - by Clay Nichols
    I'm planning to have a desktop app interact with some .ASP or .ASPX pages on a server. I've only done a little bit with .asp pages and I'm thinking I'd just Post or Get a URL with some variables: MySite.com/Functions.asp?FunctionName=?Paramater1=somevalue?Parameter2=... I'm wondering if there is any better way to go about this? Am I missing something? Is there perhaps a better way to go about this?

    Read the article

  • Syncronizing indices of function pointer table to table contents

    - by Thomas Matthews
    In the embedded system I'm working on, we are using a table of function pointers to support proprietary Dynamic Libraries. We have a header file that uses named constants (#define) for the function pointer indices. These values are used in calculating the location in the table of the function's address. Example: *(export_table.c)* // Assume each function in the table has an associated declaration typedef void (*Function_Ptr)(void); Function_Ptr Export_Function_Table[] = { 0, Print, Read, Write, Process, }; Here is the header file: *export_table.h* #define ID_PRINT_FUNCTION 1 #define ID_READ_FUNCTION 2 #define ID_WRITE_FUNCTION 3 #define ID_PROCESS_FUNCTION 4 I'm looking for a scheme to define the named constants in terms of their location in the array so that when the order of the functions changes, the constants will also change. (Also, I would like the compiler or preprocessor to calculate the indices to avoid human mistakes like typeo's.)

    Read the article

  • Function pointers in javascript using django

    - by Hulk
    Is this a valid function pointer code below, In views , def change(request): dict={} function_ptr="create()" dict.update({'function_ptr' : function_ptr}) return render_to_response('mpjt/create.html',context_instance=RequestContext(request,{'dict': dict})) In create.html $(document).ready(function() { var a = '{{dict.function_ptr}}' func_ptr(a); function create() { alert('got respponse'); } }); Thanks..

    Read the article

  • How to "pin" C++/CLI pointers

    - by Kumar
    I am wrapping up a class which reading a custom binary data file and makes the data available to a .net/c# class However a couple of lines down the code, i start getting the memory access violation error which i believe is due to the GC moving memory around, the class is managed Here's the code if ( ! reader.OpenFile(...) ) return ; foreach(string fieldName in fields) { int colIndex = reader.GetColIndex( fieldName ); int colType = reader.GetColType( colIndex ); // error is raised here on 2nd iteration } for ( int r = 0 ; r < reader.NumFields(); r++ ) { foreach(string fieldName in fields) { int colIndex = reader.GetColIndex( fieldName ); int colType = reader.GetColType( colIndex ); // error is raised here on 2nd iteration switch ( colType ) { case 0 : // INT processField( r, fieldName, reader.GetInt(r,colIndex) ); break ; .... } } } .... i've looked at interior_ptr, pin_ptr but they give an error c3160 cannot be in a managed class Any workaround ? BTW, this is my 1st C++ program in a very long time !

    Read the article

  • Question about C Pointers (just learning)

    - by Mike
    I am curious as to why this is an error and what the error message means. Here is some code. int *x[] = {"foo", "bar", "baz"}; int *y[] = {"foo", "bar", "baz"}; x = y; I try to compile and I get this: error: incompatible types when assigning to type ‘char [3]’ from type ‘char *’ Question #1 why is this an error? and Question #2 why are the types different? Thanks for you help.

    Read the article

  • How to determine 2D unsigned short pointers array length in c++

    - by tuman
    Hello, I am finding it difficult to determine the length of the columns in a 2D unsigned short pointer array. I have done memory allocation correctly as far as I know. and can print them correctly. plz see the following code segment: int number_of_array_index_required_for_pointer_abc=3; char A[3][16]; strcpy(A[0],"Hello"); strcpy(A[1],"World"); strcpy(A[2],"Tumanicko"); cout<<number_of_array_index_required_for_pointer_abc*sizeof(unsigned short)<<endl; unsigned short ** pqr=(unsigned short **)malloc(number_of_array_index_required_for_pointer_abc*sizeof(unsigned short)); for(int i=0;i<number_of_array_index_required_for_pointer_abc;i++) { int ajira = strlen(A[i])*sizeof(unsigned short); cout<<i<<" = "<<ajira<<endl; pqr[i]=(unsigned short *)malloc(ajira); cout<<"alocated pqr[i]= "<<sizeof pqr<<endl; int j=0; for(j=0;j<strlen(A[i]);j++) { pqr[i][j]=(unsigned short)A[i][j]; } pqr[i][j]='\0'; } for(int i=0;i<number_of_array_index_required_for_pointer_abc;i++) { //ln= (sizeof pqr[i])/(sizeof pqr[0]); //cout<<"Size of pqr["<<i<<"]= "<<ln<<endl; // I want to know the size of the columns i.e. pqr[i]'s length instead of finding '\0' for(int k=0;(char)pqr[i][k]!='\0';k++) cout<<(char)pqr[i][k]; cout<<endl; }

    Read the article

  • Pointer to another classs as a property

    - by arjacsoh
    Why I receive an error when I try to create a property to another class through a pointer like that: #ifndef SQUARE_H #define SQUARE_H #include <string> //using namespace std; #include "Player.h" class Square { public: Square(int); void process(); protected: int ID; Player* PlayerOn; <--- }; #endif and the Player class is : #ifndef PLAYER_H #define PLAYER_H #include <string> //using namespace std; #include "Square.h" class Player { public: Player(int,int); // ~Player(void); int playDice(); private: int ID; int money; }; #endif I receive: syntax error missing ; before * (on the declaration of Player* PlayerOn;) and missing type specifier (on the same line...)

    Read the article

  • How does the below program work in c++?

    - by Srinivasa Varadan
    I have just created 2 pointers which has undefined behavior and try to invoke a class member function which has no object created ? I don't understand this? #include<iostream> using namespace std; class Animal { public: void talk() { cout<<"I am an animal"<<endl; } }; class Dog : public Animal { public: void talk() { cout<<"bark"<<endl; } }; int main() { Animal * a; Dog * d; d->talk(); a->talk(); }

    Read the article

  • Code formatting when using pointers

    - by HD-VRSCA
    Is there any reason why the asterisk is next to the object type in this code? I'm a little confused by the way I see this used. Some times it looks like this: NSString* stringBefore; and sometimes like this: NSString *stringBefore; Is there a difference? Or a right or wrong way to do this? Thanks

    Read the article

  • Boost Shared Pointers and Memory Management

    - by Izza
    I began using boost rather recently and am impressed by the functionality and APIs provided. In using boost::shared_ptr, when I check the program with Valgrind, I found a considerable number of "Still reachable" memory leaks. As per the documentation of Valgrind, these are not a problem. However, since I used to use the standard C++ library only, I always made sure that any program written is completely free from memory leaks. My question is, are these memory leaks something to worry about? I tried using reset(), however it only decrements the reference count, doesn't deallocate memory. Can I safely ignore these, or any way to forcibly deallocate the memory allocated by boost::shared_ptr? Thank you.

    Read the article

  • calling resize on std vector of pointers crashed

    - by user11869
    The problem can be reproduced using VS 2013 Express. It crashed when internal vector implementation tried to deallocate the original vector. However, the problem can solved by using 'new' instead of 'malloc'. Anyone can shed some light on this? struct UndirectedGraphNode { int label; vector<UndirectedGraphNode *> neighbors; UndirectedGraphNode(int x) : label(x) {}; }; int main(int argc, char** argv) { UndirectedGraphNode* node1 = (UndirectedGraphNode*)malloc(sizeof(UndirectedGraphNode)); node1->label = 0; node1->neighbors.resize(2); return 0; }

    Read the article

  • Retrieving Relationships from within two arrays of pointers

    - by DanF
    In a portion of a program I'm working on, I need to count all the times each person has worked on projects with each other person. Let's say we have "Employee" entities and "Session" entities. In each session, there are four project types, "A", "B", "C", & "D", each a many-to-many relationship to Employees. I'm making a loop to systematically review every person a selected person has worked with. First, I put all their project types in a single array, so it's easier to loop through, but by the time I ask the last nested Project for its Employee members, I get an "unrecognized selector" error. IBOutlet NSArrayController * list; int x; for(x = 0; x < [list count]; x++){ NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectAs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectBs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectCs"]; NSArray *A = [[list objectAtIndex:x] valueForKey:@"projectDs"]; NSArray *masterList = [[NSArray alloc] initWithObjects: projectAs, projectBs, projectCs, projectDs, nil]; int y; for(y = 0; y < [masterList count]; y++){ int z; for(z = 0; z < [[masterlist objectAtIndex:y] count]; z++){ //And now to make an Array of this employee's partners on the selected object, to run comparisons on. //I also have an array of keys for each session's teams, so that's what I'm referencing here: NSArray * thisTeam = [list objectAtIndex:y] objectAtIndex:z] valueForKey:projectKey]; This throws an exception... namely, -[_NSFaultingMutableSet objectAtIndex:]: unrecognized selector sent to instance What's wrong with that last Array creation?

    Read the article

  • How to pass a member function to a function used in another member function?

    - by Tommaso Ferrari
    I found something about my problem, but I don't already understand very well. I need to do something like this: class T{ double a; public: double b; void setT(double par){ a=par; }; double funct(double par1) { return par1/a; } void exec(){ b=extfunct(funct, 10); } } double extfunct(double (*f)(double),double par2){ return f(par2)+5; } Operation and function are only for example, but the structure is that. The reason of this structure is that I have a precostituited class which finds the minimum of a gived function (it's extfunct in the example). So I have to use it on a function member of a class. I understood the difference between pointer to function and pointer to member function, but I don't understand how to write it. Thanks, and sorry for the poor explanation of the problem.

    Read the article

  • C++: Pointers and scope

    - by oh boy
    int* test( ) { int a = 5; int* b = &a; return b; } Will the result of test be a bad pointer? As far as I know a should be deleted and then b would become a messed up pointer, right? How about more complicated things, not an int pointer but the same with a class with 20 members or so?

    Read the article

  • Need some pointers/hints in writing a Windows Application

    - by Bragaadeesh
    Hi, I want to create applications in windows that has complete portability (within windows OSes of course). I have tried using one application written in Visual C++ but I had a real tough time in making it run in other windows OS (like it required .net framework libraries to be installed). This put me on the back foot because I had to copy a set of DLLs from one machine to another and most of the time something works some does not. And I am TOTAL amateur in writing windows based applications since my technological forte is mostly Java. Where to kick off? (like which tools/IDEs to begin with since I am seriously into writing my own utilities/tools). I am open to clarification should you guys feel my question is vague/blunt. Thanks.

    Read the article

  • C++ pointers and constructors

    - by lego69
    if I have this snippet of the code A a1(i); A a2 = a1; A *pa1 = new A(a2); can somebody please explain what exactly the last line does, it makes copy of the a2 and pointer for this new object is pa1 or it just creates pointer for a2, thanks in advance

    Read the article

  • How to copy a structure with pointers to data inside (so to copy pointers and data they point to)?

    - by Kabumbus
    so I have a structure like struct GetResultStructure { int length; char* ptr; }; I need a way to make a full copy of it meaning I need a copy to have a structure with new ptr poinnting on to copy of data I had in original structure. Is It any how possible? I mean any structure I have which contains ptrs will have some fields with its lengths I need a function that would copy my structure coping all ptrs and data they point to by given array of lengthes... Any cool boost function for it? Or any way how to create such function?

    Read the article

  • base pointer to derived class

    - by Jay
    Suppose there are Base class and Derived class. Base *A = new Base; Here A is a pointer point to Base class, and new constructs one that A points to. I also saw Base *B = new Derived; How to explain this? B is a pointer to Base Class, and a Derived class constructed and pointed by B? If there is a function derived from Base class, say, Virtual void f(), and it's been overridden in Derived class, then B->f() will invoke which version of the function? version in Base class, or version that overridden in Derived Class. What if there is a new function void g()in Derived, is B->g() going to invoke this function properly? One more is, is int *a = new double; or int *a = new int; legal?

    Read the article

  • Creating a function within a loop (pointers?)

    - by user352151
    Im trying to create a simple loop that creates 50 buttons, adds them to screen and then when a button is pressed, it traces out that number. I can get it to work by doing stuff I consider hacky (such as using the buttons X/Y location to determine its value), but I'd rather just be able to hold a single value in the function. The code itself is: for (var a:int = 0; a < 5; a++) { for (var b:int = 0; b < 10; b++) { var n = (a * 10) + b + 1; var btt:SimpleButton = new BasicGameButton(); btt.x = 20 + b * 50; btt.y = 50 + a * 80; addChild(btt); btt.addEventListener(MouseEvent.CLICK, function f() { trace(n); } ); } } At the moment, whenever a button is pressed, it simply outputs "50". Is there a way of "freezing" the value of n when the function is created, for that function? (BasicGameButton is just a square button, created in the flash library) Many thanks.

    Read the article

  • Grabbing value of pointers

    - by user1205956
    In C++ I am making a static library where I must set two variables equal to the value of the objects sent in to the method. This is what I have: bool setTags(char *pStartTag, char *pEndTag) { // Code to set the tags here. return true; } Basically the calling function puts in two character arrays. I am required to do it this way so I cannot deviate on these ways. How do I set two variables equal to the whole character array that is passed through?

    Read the article

  • Assigning variables to pointers

    - by tys
    When compiling the below, the program seem to crash. However, there is no error in the compiling process. ... int *x; *x = 3; printf("%d", *x); ... From what I know, this program initializes the pointer *x to an integer value, and subsequently assigns the value of 3 to the deferenced pointer *x. So why does the program crashes? If I do this instead, the program can work normally. ... int *x, y; y = 3; x = &y; printf("%d", *x); ... So, what seems to be the problem with the skipping of the y variable, and instead, assigning the pointer *x directly to an integer value?

    Read the article

  • Binary Tree in C Insertion Error

    - by Paul
    I'm quite new to C and I'm trying to implement a Binary Tree in C which will store a number and a string and then print them off e.g. 1 : Bread 2 : WashingUpLiquid etc. The code I have so far is: #include <stdio.h> #include <stdlib.h> #define LENGTH 300 struct node { int data; char * definition; struct node *left; struct node *right; }; struct node *node_insert(struct node *p, int value, char * word); void print_preorder(struct node *p); int main(void) { int i = 0; int d = 0; char def[LENGTH]; struct node *root = NULL; for(i = 0; i < 2; i++) { printf("Please enter a number: \n"); scanf("%d", &d); printf("Please enter a definition for this word:\n"); scanf("%s", def); root = node_insert(root, d, def); printf("%s\n", def); } printf("preorder : "); print_preorder(root); printf("\n"); return 0; } struct node *node_insert(struct node *p, int value, char * word) { struct node *tmp_one = NULL; struct node *tmp_two = NULL; if(p == NULL) { p = (struct node *)malloc(sizeof(struct node)); p->data = value; p->definition = word; p->left = p->right = NULL; } else { tmp_one = p; while(tmp_one != NULL) { tmp_two = tmp_one; if(tmp_one->data > value) tmp_one = tmp_one->left; else tmp_one = tmp_one->right; } if(tmp_two->data > value) { tmp_two->left = (struct node *)malloc(sizeof(struct node)); tmp_two = tmp_two->left; tmp_two->data = value; tmp_two->definition = word; tmp_two->left = tmp_two->right = NULL; } else { tmp_two->right = (struct node *)malloc(sizeof(struct node)); tmp_two = tmp_two->right; tmp_two->data = value; tmp_two->definition = word; tmp_two->left = tmp_two->right = NULL; } } return(p); } void print_preorder(struct node *p) { if(p != NULL) { printf("%d : %s\n", p->data, p->definition); print_preorder(p->left); print_preorder(p->right); } } At the moment it seems to work for the ints but the description part only prints out for the last one entered. I assume it has something to do with pointers on the char array but I had no luck getting it to work. Any ideas or advice? Thanks

    Read the article

  • Is it a good practice to always use smart pointers ?

    - by Dony Borris
    Hi, I find smart pointers to be a lot more comfortable than raw pointers. So is it a good idea to always use smart pointers? ( Please note that I am from Java background and hence don't much like the idea of explicit memory management. So unless there are some serious performance issues with smart pointers, I'd like to stick with them. ) Any advice would be greatly appreciated. Thanks.

    Read the article

  • C# Implementing a custom stream writer-esque class

    - by Luke
    How would I go about writing my own stream manipulator class? Basically what I'm trying to wrap my head around is storing the reference to the underlying stream in the writer. For example, when writing to a memory stream using a StreamWriter, when a Write() is made, the underlying memory stream is written to. Can I store the reference to an underlying stream without using pointers or unsafe code? Even if it was just a string I wanted to "write" to. Really this has little to do with stream writers, and I'm just wondering how I could store references in a class. The StreamWriter was the best example I could come up with for this.

    Read the article

  • NSArrays in NSArrays. A pointer problem?

    - by RyJ
    I believe my problem involves pointers, a concept I often struggle with, but here's what I'm trying to do. I have six NSArrays. I want an additional NSArray comprised of these six arrays, so: self.arr1 = [NSArray array]; self.arr2 = [NSArray array]; self.arr3 = [NSArray array]; self.arr4 = [NSArray array]; self.arr5 = [NSArray array]; self.arr6 = [NSArray array]; NSArray *containerArray = [[NSArray alloc] initWithObjects:self.arr1, ... etc, nil]; Whenever I update one of the first 6 NSArrays, I want the object updated in containerArray. (I know I'm using an NSArray and not an NSMutableArray, when I update the arrays I create a new one and assign it to the instance variable). Currently, any manipulation of arr1 is not reflected in [containerArray objectAtIndex:0].

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >