Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 96/144 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • Potential problems porting to different architectures

    - by Brendan Long
    I'm writing a Linux program that currently compiles and works fine on x86 and x86_64, and now I'm wondering if there's anything special I'll need to do to make it work on other architectures. What I've heard is that for cross platform code I should: Don't assume anything about the size of a pointer, int or size_t Don't make assumptions about byte order (I don't do any bit shifting -- I assume gcc will optimize my power of two multiplication/division for me) Don't use assembly blocks (obvious) Make sure your libraries work (I'm using SQLite, libcurl and Boost, which all seem pretty cross-platform) Is there anything else I need to worry about? I'm not currently targeting any other architectures, but I expect to support ARM at some point, and I figure I might as well make it work on any architecture if I can. Also, regarding my second point about byte order, do I need to do anything special with text input? I read files with getline(), so it seems like that should be done automatically as well.

    Read the article

  • How to append text to a text file in WinAPI?

    - by Bruce
    Hi guys, Ive got an annoying problem, I cant append any text to the text file. Every time I open it for writing, I overwrite the data. I tried to move the file pointer to the end of the file, but no result (no writing to the file at all). Here is the code: INVOKE CreateFile, offset filePath, GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 mov hFile, eax mov edx, 10 INVOKE SetFilePointer, hFile, 0, 0, FILE_END INVOKE WriteFile, hFile, offset buffer, edx, ADDR SizeReadWrite, NULL INVOKE CloseHandle, hFile Any ideas? Thank you in advance!

    Read the article

  • Treat a void function as a value

    - by Brendan Long
    I'm writing some terrible, terrible code, and I need a way to put a free() in the middle of a statement. The actual code is: int main(){ return printf("%s", isPalindrome(fgets(malloc(1000), 1000, stdin))?"Yes!\n":"No!\n") >= 0; // leak 1000 bytes of memory } I was using alloca(), but I can't be sure that will actually work on my target computer. My problem is that free returns void, so my code has this error message: error: void value not ignored as it ought to be The obvious idea I had was: int myfree(char *p){ free(p); return 0; } Which is nice in that it makes the code even more unreadable, but I'd prefer not to add another function. I also briefly tried treating free() as a function pointer, but I don't know if that would work, and I don't know enough about C to do it properly. Note: I know this is a terrible idea. Don't try this at home kids.

    Read the article

  • How to change input button image using CSS?

    - by Baltimark
    So, I can create an input button with an image using <INPUT type="image" src="/images/Btn.PNG" value=""> But, I can't get the same behavior using CSS. for instance, i've tried <INPUT type="image" class="myButton" value=""> where "myButton" is defined in the css file as .myButton{ background:url(/images/Btn.PNG) no-repeat; cursor:pointer; width: 200px; height: 100px; border: none; } If that's all I wanted to do, I could use the original style, but I want to change the button's appearance on hover (using a myButton:hover class). I know the links are good because I've been able to load them for a background image for other parts of the page (just as a check). I found examples on the web of how to do it using javascript, but I'm looking for a css solution. I'm using Firefox 3.0.3 if that makes a difference. Thanks

    Read the article

  • Why doesn't Perl threading work when I call readdir beforehand?

    - by Kevin
    Whenever I call readdir before I create a thread, I get an error that looks like this: perl(2820,0x7fff70c33ca0) malloc: * error for object 0x10082e600: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug Abort trap What's strange is that it happens when I call readdir before I create a thread (i.e. readdir is not called in any concurrent code). I don't even use the results from readdir, just making the call to it seems to screw things up. When I get rid of it, things seem to work fine. Some example code is below: opendir(DIR, $someDir); my @allFiles = readdir(DIR); close(DIR); my $thread = threads-create(\&sub1); $thread-join(); sub sub1 { print "in thread\n" }

    Read the article

  • What is XcvPort (used in OpenPrinter function)

    - by RiskX
    I'm usin the OpenPrinter function and the first parameter the function gets called "pPrinterName" and that's it's MSDN description: [in] Pointer to a null-terminated string that specifies the name of the printer or print server, the printer object, the XcvMonitor, or the XcvPort. For a printer object use: PrinterName,Job xxxx. For an XcvMonitor, use: ServerName,XcvMonitor MonitorName. For an XcvPort, use: ServerName,XcvPort PortName. Obviously I'm interested in the bold part. What exactly is XcvPort? I know it seems like a question of lazy person but I really couldn't find info abou this concept. If I would like to open a printer on port ABC I should write: "\\MySrever,XcvPort ABC"? Thank you for your answers!

    Read the article

  • I'm new to C++. Please Help me with the Linked List (What functions to add)?

    - by Igal
    DEAR All; Hi, I'm just beginner to C++; Please help me to understand: What functions should be in the Linked list class ? I think there should be overloaded operators << and ; Please help me to improve the code (style, errors, etc,) Thanks for advance. Igal. Please review the small code for the integer List (enclosed MyNODE.h and ListDriver1.cpp); MyNODE.h // This is my first attempt to write linked list. Igal Spector, June 2010. #include <iostream.h> #include <assert.h> //Forward Declaration of the classes: class ListNode; class TheLinkedlist; // Definition of the node (WITH IMPLEMENTATION !!!, without test drive): class ListNode{ friend class TheLinkedlist; public: // constructor: ListNode(const int& value, ListNode *next= 0); // note: no destructor, as this handled by TheLinkedList class. // accessor: return data in the node. // int Show() const {return theData;} private: int theData; //the Data ListNode* theNext; //points to the next node in the list. }; //Implementations: //constructor: inline ListNode::ListNode(const int &value,ListNode *next) :theData(value),theNext(next){} //end of ListNode class, now for the LL class: class TheLinkedlist { public: //constructors: TheLinkedlist(); virtual ~TheLinkedlist(); // Accessors: void InsertAtFront(const &); void AppendAtBack(const &); // void InOrderInsert(const &); bool IsEmpty()const;//predicate function void Print() const; private: ListNode * Head; //pointer to first node ListNode * Tail; //pointer to last node. }; //Implementation: //Default constructor inline TheLinkedlist::TheLinkedlist():Head(0),Tail(0) {} //Destructor inline TheLinkedlist::~TheLinkedlist(){ if(!IsEmpty()){ //list is not empty cout<<"\n\tDestroying Nodes"<<endl; ListNode *currentPointer=Head, *tempPtr; while(currentPointer != 0){ //Delete remaining Nodes. tempPtr=currentPointer; cout<<"The node: "<<tempPtr->theData <<" is Destroyed."<<endl<<endl; currentPointer=currentPointer->theNext; delete tempPtr; } Head=Tail = 0; //don't forget this, as it may be checked one day. } } //Insert the Node to the beginning of the list: void TheLinkedlist::InsertAtFront(const int& value){ ListNode *newPtr = new ListNode(value,Head); assert(newPtr!=0); if(IsEmpty()) //list is empty Head = Tail = newPtr; else { //list is NOT empty newPtr->theNext = Head; Head = newPtr; } } //Insert the Node to the beginning of the list: void TheLinkedlist::AppendAtBack(const int& value){ ListNode *newPtr = new ListNode(value, NULL); assert(newPtr!=0); if(IsEmpty()) //list is empty Head = Tail = newPtr; else { //list is NOT empty Tail->theNext = newPtr; Tail = newPtr; } } //is the list empty? inline bool TheLinkedlist::IsEmpty() const { return (Head == 0); } // Display the contents of the list void TheLinkedlist::Print()const{ if ( IsEmpty() ){ cout << "\n\t The list is empty!!"<<endl; return; } ListNode *tempPTR = Head; cout<<"\n\t The List is: "; while ( tempPTR != 0 ){ cout<< tempPTR->theData <<" "; tempPTR = tempPTR->theNext; } cout<<endl<<endl; } ////////////////////////////////////// The test Driver: //Driver test for integer Linked List. #include <iostream.h> #include "MyNODE.h" // main Driver int main(){ cout<< "\n\t This is the test for integer LinkedList."<<endl; const int arraySize=11, ARRAY[arraySize]={44,77,88,99,11,2,22,204,50,58,12}; cout << "\n\tThe array is: "; //print the numbers. for (int i=0;i<arraySize; i++) cout<<ARRAY[i]<<", "; TheLinkedlist list; //declare the list for(int index=0;index<arraySize;index++) list.AppendAtBack( ARRAY[index] );//create the list cout<<endl<<endl; list.Print(); //print the list return 0; //end of the program. }

    Read the article

  • Struct size containing vector<T> different sizes between DLL and EXE..

    - by Michael Peddicord
    I have this situation where an EXE program imports a DLL for a single function call. It works by passing in a custom structure and returning a different custom structure. Up till now it's worked fine until I wanted one of the structs data members to be a vector < MyStruct When I do a sizeof(vector< MyStruct ) in my program I get a size of 20 but when I do it from inside the DLL I get a size of 24. This size inconsistency is causing a ESP pointer error. Can anyone tell me why a Vector < MyStruct would be a different size in the DLL than in the program? I have reverified that my structs in both the DLL and the Program are identical. I would appreciate any help on the subject. Thank you.

    Read the article

  • typedef declaration syntax

    - by mt_serg
    Some days ago I looked at boost sources and found interesting typedef. There is a code from "boost\detail\none_t.hpp": namespace boost { namespace detail { struct none_helper{}; typedef int none_helper::*none_t ; } // namespace detail } // namespace boost I didn't see syntax like that earlier and can't explain the sense of that. This typedef introduces name "none_t" as pointer to int in boost::detail namespace. What the syntax is? And what difference between "typedef int none_helper::*none_t" and for example "typedef int *none_t" ?

    Read the article

  • Objective-C: Initializing char with char at index of string.

    - by Mr. McPepperNuts
    unichar myChar = [myString characterAtIndex:0]; [myNSMutableArray addObject:myChar]; I am trying to insert the first char of a string into an array, to create an array of chars. the first line does not give me an error. The second line however, provides the following error: warning: passing argument 1 of 'addObject:' makes pointer from integer without a cast This also crashes the application with a "bad address" error. I thought this error was due to a problem with memory allocation. Can someone shed some light on this.

    Read the article

  • Flipping around a div using Javascript

    - by Isaac Copper
    Flip is a great JQuery plugin for flipping blocks, but it doesn't preserve the background while it animates the flip. For example, I have this pretty background, here, before I flip. While flipping, it gets ugly: here. Is there a way I can flip this div nicely, keeping the pretty background I have, and maybe even achieve a smoother animation than I can get with Flip? If I need to dive into this headfirst and code my own function for flipping a div, that's also doable, and I'd really appreciate some pointer there, if that's what I must do. Thanks so much!

    Read the article

  • Objective C LValue required as unary '&' operand

    - by Bob
    Hello! In my code, I get this error when I try to get a pointer to my class property. (I wrote a small *.OBJ file translator in Python, discarding the normals) CODE: //line: line of text const char *str = [line UTF8String]; Point3D *p1, *p2, *p3; p1 = [Point3D makeX:0 Y:0 Z:0]; p2 = [Point3D makeX:0 Y:0 Z:0]; p3 = [Point3D makeX:0 Y:0 Z:0]; sscanf(str, "t %f,%f,%f %f,%f,%f %f,%f,%f",(&[p1 x]),&([p1 y]),&([p1 z]),&([p2 x]),&([p2 y]),&([p2 z]),&([p3 x]),&([p3 y]),&([p3 z])); Triangle3D *tri = [Triangle3D make:p1 p2:p2 p3:p3];

    Read the article

  • status failed for LdrLoadDll

    - by kiddo
    hello all,I'am trying to work-out the LdrLoadDll function and am having no luck with that..i also googled for some examples there is no much documentation or correct example about this.I know what it exactly does..Please check the code below. //declaration function pointer for LdrLoadDll typedef NTSTATUS (_stdcall*fp_LdrLoadDll)( IN PWCHAR PathToFile OPTIONAL, IN ULONG Flags OPTIONAL, IN PUNICODE_STRING ModuleFileName, OUT PHANDLE ModuleHandle ); //calling LdrLoadDll using getprocaddress HANDLE handle; HMODULE module = LoadLibrary(L"ntdll.dll"); fp_LdrLoadDll loadDll; loadDll = (fp_LdrLoadDll)GetProcAddress(module,"LdrLoadDll"); if(loadDll == NULL) { MessageBox(0,L"Not able to load the function",L"LdrLoadDll",&handle); } UNICODE_STRING input; input.Buffer = L"C:\\Desktop\\myDll.dll"; input.Length = wcslen(input.Buffer)*2; input.MaximumLength = wcslen(input.Buffer) +2; NTSTATUS status = loadDll(NULL,LOAD_WITH_ALTERED_SEARCH_PATH,&input,0); When i execute the above am not getting the handle niether valid status.Please help me with this.

    Read the article

  • How do I split up a long value (32 bits) into four char variables (8bits) using C?

    - by Jordan S
    I have a 32 bit long variable, CurrentPosition, that I want to split up into 4, 8bit characters. How would I do that most efficiently in C? I am working with an 8bit MCU, 8051 architectecture. unsigned long CurrentPosition = 7654321; unsigned char CP1 = 0; unsigned char CP2 = 0; unsigned char CP3 = 0; unsigned char CP4 = 0; // What do I do next? Should I just reference the starting address of CurrentPosition with a pointer and then add 8 two that address four times? It is little Endian. ALSO I want CurrentPosition to remain unchanged.

    Read the article

  • Boost singleton and undefined reference

    - by Ockonal
    Hello, I globally use singleton pattern in my project. To make it easier - boost::singleton. Current project uses Ogre3d library for rendering. Here is some class: class GraphicSystem : public singleton<GraphicSystem> { private: Ogre::RenderWindow *mWindow; public: Ogre::RenderWindow *getWindow() const { return mWindow; } }; In GraphicSystem constructor I fill the mWindow value: mWindow = mRoot->createRenderWindow(...); I cheked it, everything makes normally. So, now I have to use handler for the window in input system (to get window handle). Somewhere else in another class: Ogre::RenderWindow *temp = GraphicSystem::get_mutable_instance().getWindow(); GraphicSystem::get_mutable_instance().getWindow()->getCustomAttribute("WINDOW", &mWindowHandle); temp is 0x00, and there is segfault at last line (getting custon attribute). I can't understand, why does singleton returns undefined pointer for the window. All another singleton-based classes work well.

    Read the article

  • Handle/Grip bar convention

    - by tomdemuyt
    Greetings, Because textarea elements do not resize with jquery.touch ( http://plugins.jquery.com/project/touch ), I've put an textarea in a table where the first row allows the user to drag the table around and resize it with the textarea growing/shrinking/moving along. It works well, except that users dont seem to 'get' that they can use the bar to resize/move. I was trying to find some 'grip bar' graphics but google isnt helping me. What is the best way to show users that an element can be moved/resized ? Pointer to graphics ( generators ) would be great. Or, does any one know how to make textarea's movable/resizable ? T.

    Read the article

  • jQuery .submit() woes with IE8

    - by Jitesh
    I am trying to submit a delete link click via a http post to my asp.net mvc controller. While my code below works for chrome it does not work in IE8. Any pointer will be very useful. Setup:- Browser: IE8 jQuery: 1.4.1 MVC: 2.0 The delete link is:- <a title="Delete contact" href="/Contacts/Delete/<%= Model.Contact.Id %>" class="delete" rel="Are you sure you want to delete <%= Html.Encode(Model.Contact.Name) %>?">Delete</a> and the jqeury handler for the click of delete is $("a.delete").click(function() { if (confirm($(this).attr("rel"))) { var form = "<form method='POST' action='" + $(this).attr("href") + '" style='display:none;'></form>"; $(form).submit(); } return false; });

    Read the article

  • Interpreter in C++: Function table storage problem

    - by sub
    In my interpreter I have built-in functions available in the language like print exit input, etc. These functions can obviously be accessed from inside the language. The interpreter then looks for the corresponding function with the right name in a vector and calls it via a pointer stored with its name. So I gather all these functions in files like io.cpp, string.cpp, arithmetic.cpp. But I have to add every function to the function list in the interpreter in order for it to be found. So in these function files I have things like: void print( arg ) { cout << arg.ToString; } I'd add this print function to the interpreter function list with: interpreter.AddFunc( "print", print ); But where should I call the interpreter.AddFunc? I can't just put it there below the print function as it has to be in a function according to the C++ syntax. Where and how should all the functions be added to the list?

    Read the article

  • File in binary form

    - by Abhi
    Dear All I want to write data into the file in binary form. I was trying using the mentioned below FILE *fp = fopen("binaryoutput.rgb888", "ab+"); for(int m=0; m<height; m++) { for (int n=0; n< width; n++) { temp = (pOutputImg+m*3+n*3); // here temp is a pointer to a unsigned char fprintf(fp,"%u",*temp); } } fclose(fp); I am able to get data which is strored at pOutputImg but not in binary form. Can anyone guide me the correct step.. Thanks in advance

    Read the article

  • SSL_CTX_set_cert_verify_callback vs. SSL_CTX_set_verify

    - by BreakPoint
    Hello, Can anyone tell me what is the difference between SSL_CTX_set_cert_verify_callback and SSL_CTX_set_verify? From OpenSSL docs: SSL_CTX_set_cert_verify_callback() sets the verification callback function for ctx. SSL objects that are created from ctx inherit the setting valid at the time when SSL_new(3) is called. and: SSL_CTX_set_verify() sets the verification flags for ctx to be mode and specifies the verify_callback function to be used. If no callback function shall be specified, the NULL pointer can be used for verify_callback. So I'm trying to understand which callback to send for each one (from client side). Thanks experts.

    Read the article

  • QList as a function parameter - Linking Error - LNK2019

    - by user2445136
    I have an issue with QList as a function parameter and I'll be glad if you can assist me. I have this code for example: void SpinBoxList_Enable(QList spinBoxList) { foreach(QWidget mWidget,*spinBoxList) mWidget-setEnabled(false); } and in the implemantation file I use the QList variable as a pointer: SpinBoxList_Enable(&controlBoardSpinBoxList); ( controlBoardSpinBoxList is a variable of QList ). The Function ToggleBoards_Slot(bool) is a slot that uses When I compile, I get this error message: 1cmosaixserialnumber.obj : error LNK2019: unresolved external symbol "private: void __cdecl CMosaixSerialNumber::SpinBoxList_Disable(class QList *)" (?SpinBoxList_Disable@CMosaixSerialNumber@@AEAAXPEAV?$QList@PEAVQWidget@@@@@Z) referenced in function "public: void __cdecl CMosaixSerialNumber::ToggleBoards_Slot(bool)" (?ToggleBoards_Slot@CMosaixSerialNumber@@QEAAX_N@Z) 1cmosaixserialnumber.obj : error LNK2019: unresolved external symbol "private: void __cdecl CMosaixSerialNumber::SpinBoxList_Enable(class QList *)" (?SpinBoxList_Enable@CMosaixSerialNumber@@AEAAXPEAV?$QList@PEAVQWidget@@@@@Z) referenced in function "private: void __cdecl CMosaixSerialNumber::on_ControlBoardCheckBox_StateChanged(int)" (?on_ControlBoardCheckBox_StateChanged@CMosaixSerialNumber@@AEAAXH@Z) How can I fix this ? Thanks, EVH671

    Read the article

  • C++ - Opening a file inside a function using fopen

    - by Josh
    I am using Visual Studio 2005 (C++). I am passing a string into a function as a char array. I want to open the file passed in as a parameter and use it. I know my code works to an extent, because if I hardcode the filename as the first parameter it works perfectly. I do notice if I look at the value as a watch, the value includes the address aside the string literal. I have tried passing in the filename as a pointer, but it then complains about type conversion with __w64. As I said before it works fine with "filename.txt" in place of fileName. I am stumped. void read(char fileName[50],int destArray[MAX_R][MAX_C],int demSize[2]) { int rows=0; int cols=0; int row=0; int col=0; FILE * f = fopen(fileName,"r"); ...

    Read the article

  • menuitem id in xml format can't be an integer? huh. really?

    - by misbell
    ok, in menu.add, you add an integer menuitem id. But when you specify the menu in xml, @+id can't take an integer, so you can't test the id for the menu item as an integer in a switch statement. What obvious thing am I missing, because surely an inconsistency this bone-stupid couldn't have passed muster with all those wonderful geniuses at Google. on top of that, when I give the menu item a name like "@+id/myMenuItem", item.getItemId() returns an integer, a long one, which I guess is a representation of the hex pointer. M

    Read the article

  • Copying pointers in C++

    - by tunnuz
    Hello, I have a class A containing two pointers to objects of another class B. I want to initialize one pointer or the other depending on which one is passed to init(), which also takes other parameters. My situation is thus the following: class A { public: A(); init(int parameter, int otherParameter, B* toBeInitialized); protected: B* myB; B* myOtherB; }; Now my point is that I want to call init() as: init(640, 480, this->myB); or init(640, 480, this->myOtherB); Now, my init is implemented as: void init( int parameter, int otherParameter, B* toBeInitialized ) { toBeInitialized = someConstructorFunction(parameter, otherParameter); } The problem is that the two pointers are not initialized, I suspect that toBeInitialized is overwritten, but the original parameter is not modified. I am doing something wrong? Should I use references to pointers? Thank you Tommaso

    Read the article

  • Grid view update event form javascript

    - by pranay
    I have grid control select <%--Select--% </ItemTemplate> </asp:TemplateField> </columns> <pagersettings mode="NumericFirstLast" position="Top" pagebuttoncount="5" /> <pagerstyle backcolor="Pink" /> </cc:AppEngineGridView> my code on row create protected override void OnRowCreated(GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.ID = this.ID + "_" + e.Row.RowIndex; e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';this.style.font.weight='bolder';"); e.Row.Attributes.Add("onclick", "DoNav('" + ((LinkButton)e.Row.FindControl("lbtn1")).ClientID + "');"); } } protected void grduser_RowUpdating(object sender, GridViewUpdateEventArgs e) { grdview_RowClickCommand(sender, e); } Javascript : function DoNav(id) { $("#"+id).click(); } Now my question is when i click on the row it do post back but it didnt call rowupdate event How can do this i.e using javascript to call row update command of the grid.

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >