Search Results

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

Page 100/144 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • Is there any reason for a blocking call to winsock send() function on Vista to return immediately ?

    - by ivymike
    Hi All, Is there any reason for a blocking call to winsock's send() function on Vista to return immediately ? It works with expected delay on XP and below. I'm wondering if this has got anything to do with auto-tuning feature of Vista. Code: char *pBuffer; // pointer to data int bytes; // total size int i = 0, j=0; while (i < bytes) { j = send(m_sock, pBuffer+i, bytes-i, 0); i+=j; } Thanks, Pavan

    Read the article

  • Pointers in For loops

    - by Bobby
    Quick question: I am a C# guy debugging a C++ app so I am not used to memory management. In the following code: for(int i = 0; i < TlmMsgDB.CMTGetTelemMsgDBCount(); i++) { CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i); CMT_SINT32_Tdef id = telm->CMTGetPackingMapID(); ManualScheduleTables.SetManualMsg(i,id); ManualScheduleTables.SetManExec(i,false); } Am I leaking memory every iteration b/c of CMTTelemetryMsgCls* telm = TlmMsgDB.CMTGetTelemetryMsg(i);? The "CMTGetTelemetryMsg(int)" method returns a pointer. Do I have to "delete telm;" at the end of each iteration?

    Read the article

  • memset on array of structures in C++

    - by garry
    I have another memset question. It appears as if the code I am editing may have some issues (or it's not done the same way in different files) A::LRM las[9]; //A and LRM are both structures with BOOLS and INTS memset(&las, 0, sizeof(las)); typedef Sec SecArray[16]; SecArray rad_array; memset(rad_array, 0, sizeof(SecArray)); The second example appears to be correct because rad_array is the same as the first position in the array. Then the sizeof(SecArray)) would make sense. The first one doesn't seem correct to me. All structs are just BOOLs and INTS nothing dynamic in them. My understanding from my other post about memset was that it followed this format. memset("pointer to object", "what to set it to", "size of object") Can anyone tell me what exactly is going on here if I am incorrect with my theory.

    Read the article

  • How do IOS know which viewController is being viewed and hence need viewWillAppear to be called

    - by Jim Thio
    How does iOs know? Does each view has a pointer to it's controller? What happened? When we pop a viewController from navigation, does the navigationController arrange which view should be called? For example: If I added: [[BNUtilitiesQuick window] addSubview:[BNUtilitiesQuick searchController].view]; viewWillAppear will be called. However, window doesn't know the viewController. I am passing the view outlet of the controller not the controller. How can iOs 5 knows that it has to call [[BNUtilitiesQuick searchController] viewWillAppear:YES]

    Read the article

  • C++ associative array with arbitrary types for values

    - by Gerald Kaszuba
    What is the best way to have an associative array with arbitrary value types for each key in C++? Currently my plan is to create a "value" class with member variables of the types I will be expecting. For example: class Value { int iValue; Value(int v) { iValue = v; } std::string sValue; Value(std::string v) { sValue = v; } SomeClass *cValue; Value(SomeClass *v) { cValue = c; } }; std::map<std::string, Value> table; A downside with this is you have to know the type when accessing the "Value". i.e.: table["something"] = Value(5); SomeClass *s = table["something"].cValue; // broken pointer Also the more types that are put in Value, the more bloated the array will be. Any better suggestions?

    Read the article

  • Shell script exiting the loop after calling another script

    - by Johnyy
    Hi Guys, I have a shell script s1 calling another script s2 in a loop. However s1 can not seem to continue the loop after s2 returns. Commenting out the line that calls s2 will enable the loop to continue. s2 does copy of one file, s1 checks conditions and copy several files using s2. Can anyone give a pointer what is going on here? ... while read line s2 param1 param2 param3 echo "copy done" done < $tempfile echo "out of loop" ... "copy done" is printed, so is "out of loop"

    Read the article

  • Force an object to be allocated on the heap

    - by Warren Seine
    A C++ class I'm writing uses shared_from_this() to return a valid boost::shared_ptr<>. Besides, I don't want to manage memory for this kind of object. At the moment, I'm not restricting the way the user allocates the object, which causes an error if shared_from_this() is called on a stack-allocated object. I'd like to force the object to be allocated with new and managed by a smart pointer, no matter how the user declares it. I thought it could be done through a proxy or an overloaded new operator, but I can't find a proper way of doing that. Is there a common design pattern for such usage? If it's not possible, how can I test it at compile time?

    Read the article

  • Strange behaviour of Android debugger in Eclipse when using Camera for preview.

    - by Buzzy
    Hi, I have an Android application that uses a SurfaceView subclass and Camera object to preview images before capture. Once I capture an image, I stop the preview and release the camera. Execution stops at any breakpoint after this. However, apart from the "Suspend" and "Terminate" icons, the rest are disabled. This is strange because the "Debug Current Instruction Pointer" is clearly at the said breakpoint and execution is already suspended. I can't perform any debugging operations and have no option but to terminate the session. Sometimes (very rarely), the session terminates by itself. I can confirm that this odd behavior takes place only after I preview the camera capture. I am fairly new to Android development. Is there some obvious mistake I am making? Any help would be highly appreciated.

    Read the article

  • CSS menu is flickering when scrolling through it with hover effects

    - by kritop
    I hope i described the problem well!? You can see it here: http://dealmob.de/index_dev.html when u hover over the menu up and down fast u see the that its not staying, insteads its flickering like you would change the margins/paddings by few pixels. Any advice on how to solve this problem? thanks a lot like requested: #topcities { float:right; } #topcities li { padding-left:5px; width:100px; } #topcities li:hover { cursor:pointer; color:#000; background: url(images/hover_menue_back.jpg) repeat-x #FFF; -moz-border-radius: 5px; -webkit-border-radius: 5px; border:grey 1px solid; width:100px; }

    Read the article

  • Passing around objects to network packet handlers ?

    - by xeross
    Hey, I've been writing a networking server for a while now in C++ and have come to the stage to start looking for a way to properly and easily handle all packets. I am so far that I can figure out what kind of packet it is, but now I need to figure out how to get the needed data to the handler functions. I had the following in mind: Have a map of function pointers with the opcode as key and the function pointer as value Have all these functions have 2 arguments, packet and ObjectAccessor ObjectAccessor class contains various functions to fetch various items such as users and alike Perhaps pass the user's guid too so we can fetch it from the objectaccessor I'd like to know the various implementations others have come up with, so please comment on this idea and reply with your own implementations. Thanks, Xeross

    Read the article

  • casting issue with realpath function (c programming)

    - by Ralph
    When I compile the following code: #define _POSIX_C_SOURCE 200112L #define _ISOC99_SOURCE #define __EXTENSIONS__ #include <stdio.h> #include <limits.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *symlinkpath = argv[1]; char actualpath [PATH_MAX]; char *ptr; ptr = realpath(symlinkpath, actualpath); printf("%s\n", ptr); } I get a warning on the line that contains the call to the realpath function, saying: warning: assignment makes pointer from integer without a cast Anybody know what's up? I'm running Ubuntu Linux 9.04

    Read the article

  • Making a video with opencv and ffmpeg. How to find the right color format?

    - by luc
    I have a webcam video recorder program built with python, opencv and ffmpeg It works ok except that the color of the video is more blue than the reality. The problem seems to come from color format of images. It seems that OpenCv is giving BGR images and ffmpeg+libx264 is expecting YUV420p. I've read that YUV420p correspond to YCbCr. opencv has no conversion from BGR to YCbCr. It only has a conversion to YCrCb. I have made some searchs and tried different alternatives to try converting opencv image to something that could be ok for ffmpeg+libx264. None is working. At this point, I am a bit lost and I would appreciate any pointer that could help me to fix this color issue.

    Read the article

  • What is the logic behind defining macros inside a struct?

    - by systemsfault
    As apparent in the title, I'm questioning the reason behind defining the macros inside a struct. I frequently see this approach in network programming for instance following snippet: struct sniff_tcp { u_short th_sport; /* source port */ u_short th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ u_char th_offx2; /* data offset, rsvd */ #define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4) u_char th_flags; #define TH_FIN 0x01 #define TH_SYN 0x02 #define TH_RST 0x04 #define TH_PUSH 0x08 #define TH_ACK 0x10 #define TH_URG 0x20 #define TH_ECE 0x40 #define TH_CWR 0x80 #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR) u_short th_win; /* window */ u_short th_sum; /* checksum */ u_short th_urp; /* urgent pointer */ }; This example is from sniffex.c code in tcpdump's web site. Is this for enhancing readability and making code clearer.

    Read the article

  • Text indent is not working in ie7

    - by saorabh
    I am working on a website and on the top navigation bar there is a search box, I applied the following css on the search submit button #submit{background:url("img/new-search-icon.png") no-repeat scroll -1px 0 #FFFFFF; border:0 none; cursor:pointer; display:block; height:21px; padding:0; position:absolute; right:0; text-indent:-9999px; top:0; width:20px; z-index:2;} My Problem is in IE7 the text indent is not working please help me if you want to see the demo you can view it by clicking here Click here. Please help me.

    Read the article

  • overflow technique in stack

    - by metashockwave
    int main(void) { problem2(); } void doit2(void) { int overflowme[16]; //overflowme[37] =0; } void problem2(void) { int x = 42; doit2(); printf("x is %d\n", x); printf("the address of x is 0x%x\n", &x); } Would someone help me understand why overflowme[37] =0; from the doit2 function will overwrite the value of x? (please include Program Counter and Frame Pointer of the function doit2 in your explanation) Thank you! It works every time with Project properties-Configuration properties-C/C++ -Code Generation-Basic Runtime Checks set to "Default". so it's not an undefined behavior.

    Read the article

  • How do I change the class of an object to a subclass of its current class in C++?

    - by Jared P
    I have an array of pointers to a base class, so that I can make those pointers point to (different) subclasses of the base class, but still interact with them. (really only a couple of methods which I made virtual and overloaded) I'm wondering if I can avoid using the pointers, and instead just make an array of the base class, but have some way to set the class to the subclass of my choosing. I know there must be something there specifying the class, as it needs to use that to look up the function pointer for virtual methods. By the way, the subclasses all have the same ivars and layout. Note: the design is actually based on using a template argument instead of a variable, due to performance increases, so really the abstract base class is just the interface for the subclasses, which are all the same except for their compiled code. Thanks

    Read the article

  • What is the best way to expose a callback API - C++

    - by rursw1
    Hi, I have a C++ library that should expose some system\ resource calls as callbacks from the linked application. For example: the interfacing application (which uses this library) can send socket management callback functions - send, receive, open, close etc., and the library will use this implementation in stead of the library's implementation. (This way enables the application to manage the sockets by itself, can be useful). This library has to expose also more callbacks, like, for example, a password validation, so I wonder if there is a preferred method to expose the callback sending option in one API. Something like: int AddCallbackFunc (int functionCallbackType, <generic function prototype>, <generic way to pass some additional arguments>) Then within my library I will assign the callback to the appropriate function pointer according to the functionCallbackType parameter. Is there any way to implement it in a generic way which will fit ANY function prototype and ANY additional arguments? Your help will be more than appreciated... Thanks!

    Read the article

  • UML binary association aggregatee has access to aggregator

    - by user314172
    Firstly, I'd like to thank those who answered my previous question ages ago. Currently I'm engaging more in the design phase UMLs, as this is my first medium scale deployment I'm entrusted with. This is extremely simple, but it bugs me so. If (Component) owns (Manager of Component), and (Manager of Component) has a reference to (Component) through which it manages it; how do you fully describe the relationship? I know it is aggregative, but how do you describe (Manager of Component) possessing a reference/pointer to the (Component) that physically owns the (Manager of Component) ? Example: Lidar owns a LidarManager

    Read the article

  • not able to select hidden link - selenium

    - by Maddy
    I have to select web link when i mouse hover to particular frame in the webpage, the button(link to next page) will be visible. WebElement mainElement = driver.findElement(By.xpath(<frame xpath >)); Actions builder = new Actions(driver); builder.moveToElement(mainElement); WebElement button1 = driver.findElement(By.xpath("//*[@id='currentSkills']/div[1]/div/a")); builder.moveToElement(button1).click().perform(); I am still unable to select the particular link when i execute, the following error am getting org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 131 milliseconds But when i hover mouse pointer to the particular frame during AUT(just to move to particular frame without clicking anything), then test is executing sucessfully. I know this can be handled by JS. But i want to find out is there any solution within selenium webdriver Your help is much appreciated... Thanks Madan

    Read the article

  • Printf ubuntu Segmentation fault (core dumped)

    - by Someone
    I have this code: int a; printf("&a = %u\n",(unsigned)&a); printf("a\n"); printf("b\n"); printf("c\n"); printf("d\n"); I tried to print the pointer of a variable. But it fail on the row printf("a\n"); and says Segmentation fault (core dumped) Output: &a = 134525024 Segmentation fault (core dumped) When I remove the row printf("&a = %u\n",(unsigned)&a); from the code, its success. Output: a b c d What worng in my code?

    Read the article

  • What's the difference between initializing this structure with these strategies?

    - by mystify
    // the malloc style, which returns a pointer: struct Cat *newCat = malloc(sizeof(struct Cat)); // no malloc...but isn't it actually the same thing? uses memory as well, or not? struct Cat cat = {520.0f, 680.0f, NULL}; Basically, I can get a initialized structure in these two ways. My guess is: It's the same thing, but when I use malloc I also have to free() that. In the second case I don't have to think about memory, because I don't call malloc. Maybe. When should I use the malloc style, and when the other?

    Read the article

  • Why do virtual memory addresses for linux binaries start at 0x8048000?

    - by muteW
    Disassembling an ELF binary on a Ubuntu x86 system I couldn't help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused. This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer dereferences. The latter case looks like it can be fixed by using a single page instead of leaving a 128MB gap. So my question is this - is there a definitive answer to why the layout has been fixed to these values or is it just an arbitrary choice?

    Read the article

  • C++ Vector of pointers

    - by xbonez
    For my latest CS homework, I am required to create a class called Movie which holds title, director, year, rating, actors etc. Then, I am required to read a file which contains a list of this info and store it in a vector of pointers to Movies. I am not sure what the last line means. Does it mean, I read the file, create multiple Movie objects. Then make a vector of pointers where each element (pointer) points to one of those Movie objects? Do I just make two vectors - one of pointers and one of Movies and make a one-to-one mapping of the two vectors?

    Read the article

  • What is the role of asserts in C++ programs that have unit tests?

    - by lhumongous
    Greetings, I've been adding unit tests to some legacy C++ code, and I've run into many scenarios where an assert inside a function will get tripped during a unit test run. A common idiom that I've run across is functions that take pointer arguments and immediately assert if the argument is NULL. I could easily get around this by disabling asserts when I'm unit testing. But I'm starting to wonder if unit tests are supposed to alleviate the need for runtime asserts. Is this a correct assessment? Are unit tests supposed to replace runtime asserts by happening sooner in the pipeline (ie: the error is caught in a failing test instead of when the program is running). On the other hand, I don't like adding soft fails to code (eg: if(param == NULL) return false;). A runtime assert at least makes it easier to debug a problem in case a unit test missed a bug. Thanks!

    Read the article

  • HRESULT exception not caught in VS 2008

    - by arionik
    Hello all, I've got a stange situation in visual studio 2008 C++. I work on code that was originally written for visual studio 2003, where everything works well. Now, ported to VS 2008, the exception handling, which unfortuantely exists widely in the code, does not work anymore. standard code example: try { HRESULT hr = S_OK; // do stuff... if( FAILED( hr ) ) throw hr; } catch( HRESULT hr ) { // error handling, but we never get here } catch( ... ) { // ... not even here } Under VS 2008, no exception is encountered, but I get a crash somewhere else, indicating that the stack pointer must be screwed up. Did anybody come across this behaviour? Any help is appreciated.

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >