c++

one question about iostream cout in C++

Hi In such code, what it is called, \\n like this? cout<<"Hello\\n \'world\'!"; What's the basic rule about such characters? ...

Is using macros to abbreviate long winded boost template names a bad practice?

I am tired of writing shared_ptr<>, it's lengthening the code lines tremendously. Any reason not to do this? ...

How to use V8's built in functions

I'm new in both javascript and V8. According to Google's Embedder's Guide, I saw something in the context section talking about built-in utility javascript functions. And I also found some .js files(e.g. math.js) in the downloaded source code, so I tried to write a simple program to call functions in these files, but I failed. Does a c...

call c++ function with reference parameter from cli

The unmanaged function(pure c++): void fooC(float& result); I define the wrapper as (managed wrapper, c++\cli): void foo(float% result) //managed interface, need to pass result back to caller { fooC(???);//how to call unmanaged function? } how to pass reference parameter in the wrapper? ...

Is this a good way to manage initializations of COM?

Hello everyone :) I'm very new to anything involving Component Object Model, and I'm wondering if this method of managing calls to CoInitalize/CoUninitalize makes sense: COM.hpp: #pragma once namespace WindowsAPI { namespace ComponentObjectModel { class COM { COM(); ~COM(); public: static void Setup(); }; }} COM.cpp: ...

C++ projects based on Alan Cooper's "The Inmates are running the asylum"?

I recently read Alan Cooper's "The Inmates are running the asylum" and found it quite enlightening. Anyone of know decent C++ open source projects based on the principles in the book? I'd love to see how ideas from the book are implemented in practice. ...

SQLite file locking and DropBox

I'm developing an app in Visual C++ that uses an SQLite3 DB for storing data. Usually it sits in the tray most of the time. I also would like to enable putting my app in a DropBox folder to share it across several PCs. It worked really well up until DropBox has recently updated itself. And now it says that it "can't sync the file in us...

Tree-like queues

I'm implementing a interpreter-like project for which I need a strange little scheduling queue. Since I'd like to try and avoid wheel-reinvention I was hoping someone could give me references to a similar structure or existing work. I know I can simply instantiate multiple queues as I go along, I'm just looking for some perspective by ot...

Weird problem with string function

I'm having a weird problem with the following function, which returns a string with all the characters in it after a certain point: string after(int after, string word) { char temp[word.size() - after]; cout << word.size() - after << endl; //output here is as expected for(int a = 0; a < (word.size() - after); a++) { ...

Deleting a node in a circular linked list c++?

EDITED: using c++ to code. void circularList::deleteNode(int x) { node *current; node *temp; current = this->start; while(current->next != this->start) { if(current->next->value == x) { temp = current->next; current->next = current->next->next; delete current->next...

C++ offset of member variables?

I have: class Foo { int a; int b; std::string s; char d; }; Now, I want to know the offset of a, b, s, d given a Foo* I.e. suppose I have: Foo *foo = new Foo(); (char*) foo->b == (char*) foo + ?? ; // what expression should I put in ? ...

Best practices for handling string in VC++?

As I am new to Visual C++, there are so many types for handling string. When I use some type and go ahead with coding but on next step, there are in-build functions that use other types & it always require to convert one type of string to other. I found so many blogs but so confused when see so many answers & try but some are working & s...

Multitouch in Linux

I have two questions: How to simulate touch event in linux. How to work with multitouch on Qt in Linux. ...

Where and why JVM checks that the return type of entry method main(String args[]) is void and not anything else?

I will try to answer both, please correct me if I am wrong: Where: If a static method is being called using Classname.method() or using reflection then it doesn’t matter even if you change the return type of the calling method, the same method will still be called. So JVM probably checks this in one of the native methods of jvm.cpp ...

Formulae for U and V buffer offset

Hi all ! What should be the buffer offset value for U & V in YUV444 format type? Like for an example if i am using YV12 format the value is as follows: ppData.inputIDMAChannel.UBufOffset = iInputHeight * iInputWidth + (iInputHeight * iInputWidth)/4; ppData.inputIDMAChannel.VBufOffset = iInputHeight * iInputWidth; iInput...

I was making this program and the server wont send to the client

void CApplication::SendData( const char pBuffer[] ) { if( pBuffer == NULL ) { Log()->Write( ELogMessageType_ERROR, "Cannot send NULL message."); return; } // calculate the size of that data unsigned long messageSize = strlen( pBuffer ); // fix our byte ordering messageSize = htonl( messageSize...

Ftp library on c++ with uploading over HTTP proxy

Is anybody knows the free library for uploading over proxy with Http authentication? Maybe some url on samples how it could be. ...

On MacOSX, in a C++ program, what guarantees can I have on file IO

I am on MacOSX. I am writing a multi threaded program. One thread does logging. The non-logging threads may crash at any time. What conventions should I adopt in the logger / what guarantees can I have? I would prefer a solution where even if I crash during part of a write, previous writes still go to disk, and when reading back the lo...

How to allocate more memory for a buffer in C++?

I have pointer str: char* str = new char[10]; I use the memory block str points to to store data. How can I allocate more bytes for the buffer pointed to by str and not lose old data stored in the buffer? ...

Top level window on X Window System

Hello, I want to print on the screen the information about Top level windows under Linux. I use the xlib functions. I successfully recurse from the root window to print all the informations about all the element on display. But I need only the Top-Level window. I don't find any good way to filter. From wikipedia : The top-level w...