Now, I'm just fooling around with this and I'm not sure as to why this isn't working.
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iostream>
#include <cassert>
const char html[] = "HTTP/1.1 200 OK\r\n"
"Connection: close\r\n"
"Content-type: text/html\r\n"
"\r\n"
"<html>\r\n"
"<head>\r\n"
"<title>Hello, world!</title>\r\n"
"</h...
hi I'm very much new to openGL and I'm trying to do a small project something like a paint tool.. so i just want to save all the things in frame buffer to be saved in a file and to retrieve them back..
...
I come into a strange problem in pthread programming
I've compiled the following code in vs2005 with pthread-w32
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <pthread.h>
#include <windows.h>
pthread_mutex_t lock;
void* thread1(void *) {
int r1;
while(true) {
pthread_mutex_lock(&lock); // rand is maybe a CS
...
The title is pretty self-explanatory: does anyone know of a (good) properties file reader library for C or, if not, C++?
[Edit: To be specific, I want a library which handles the .properties file format used in Java: http://en.wikipedia.org/wiki/.properties]
...
How to find if string endswith another string c++
...
Hello,
In C# I use the Length property embedded to the array I'd like to get the size of.
How to do that in C++?
...
In Java you can define generic class that accept only types that extends class of your choice, eg:
public class ObservableList<T extends List> {
...
}
This is done using "extends" keyword.
Is there some simple equivalent to this keyword in C++?
...
If I have a dll called "foo.dll" and the end user renames it to "bar.dll" and LoadLibrary's it, how can I get the name "bar.dll" from inside my dll?
Is it GetModuleFilename(hModule, buffer); ?
...
Hello,
This is my procedure:
bool Open(std::string filename)
{
...
HANDLE hFile = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
...
}
Error:'CreateFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires re...
Hello,
I thought the problem is inside my C++ function,but I tried this
C++ Function in C++ dll:
bool __declspec( dllexport ) OpenA(std::string file)
{
return true;
}
C# code:
[DllImport("pk2.dll")]
public static extern bool OpenA(string path);
if (OpenA(@"E:\asdasd\"))
I get an exception that the memory is corrupt,why?
If ...
Is it possible to write a custom appender for log4cxx and have it configurable via a properties file (like the built-in appenders)? I'd prefer doing this without having to rebuild log4cxx (e.g. by deriving/extending an existing appender), if possible.
Can you point me toward an example?
...
Is there other technique like RVO (return value optimization) or NRVO (named return value optimization) that can be use with VC2008?
...
I have been optimising memory performance on a Windows Mobile application and have encountered some differences in behaviour between VirtualAlloc on Win32 and Windows CE.
Consider the following test:
// Allocate 64k of memory
BYTE * a = (BYTE *)VirtualAlloc(0, 65536, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
// Allocate a second contig...
If you're supposed to encapsulate everything inside a class definition, how is it then possible to use enumerated data types with the class? For example I've just written the following code...
enum PizzaType {DEEP_DISH, HAND_TOSSED, PAN};
enum PizzaSize {SMALL, MEDIUM, LARGE};
class Pizza {
public:
Pizza();
void set...
Hello,
All I need this for is strcpy().
I want to see whether the first three bytes of a buffer(byte array) are "JMX" as string.
This is what I did so far:
char * ddj;
strcpy( ddj, buffer ); //buffer is BYTE[]
if ( strcmp( "JMX", ddj ) == 0 ) //check first three chars are "JMX"
{
buffer += 20; //increase the index with 20
s...
If I have a std::vector and I want to delete the x'th element how to do it?
std::vector<int> vec;
vec.push_back(6);
vec.push_back(-17);
vec.push_back(12);
vec.erase(???);
Please help!
...
Hello,
I've been doing this in C# and Delphi ,but C++ is evil.The purpose is to create a file in the current directory(where the executable is running).
My code:
LPTSTR NPath = NULL;
DWORD a = GetCurrentDirectory(MAX_PATH,NPath);
HANDLE hNewFile = CreateFile(NPath,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
I get...
Let's consider the following scenario: a function which can generate code colors from white to red, from white to blue, from white to pink, from white to orange, etc.
The colors code is in RGB format with values from 0 to 255.
Any ideas? Can you give me the pseudocode or link to such algorithm?
...
Because I've made .cpp files then transfered them into .h files, the only difference I can find is that you can't #include .cpp files. Is there any difference that I am missing?
...
Becase I've seen (and used) situations like this:
In header.h:
class point
{
public:
point(xpos, ypos);
int x;
int y;
};
In def.cpp:
#include"header.h"
point::point(xpos, ypos)
{
x = xpos;
y = ypos;
}
In main.cpp:
#include"header.h"
int main()
{
point p1(5,6);
return 0;
}
I know the program executes ...