I am attempting to create a permutation, and I receive this strange error when I finish my problem:
Stack around the variable "temp" was corrupted
the segment of the variable is within a nested for loop:
for(int i = 0 ; i < str_length ; i++)
{
for(int j = 0 ; j < str_length ; j++)
{
char temp[1];
temp[1] = text[i];
text[i] =...
I am using the standard FindFirst and FindNext to retrieve all files in a directory
but I need the results to come back sorted ( in the same order that clicking on the name column in explorer would sort them basically )
How can I achive this
This has to be done via Win32
Thanks
...
Hi, i was wondering if there was a way to do this in C++?
void func1(const std::string& s)
{
std::cout << s << std::endl;
}
void func2(int me)
{
std::cout << me << std::endl;
}
int main()
{
std::map<std::string, boost::function< ??? > > a_map;
a_map["func1"] = &func1;
a_map["func1"]("HELLO");
}
Is there any way to do what i have a...
hey,
lets say we have a binary protocol, with fields network ordered (big endian).
struct msg1
{
int32 a;
int16 b;
uint32 c
}
if instead of copying the network buffer to my msg1 and then use the "networkToHost" functions to read msg1
I rearrange / reverse msg1 to
struct msg1
{
uint32 c
int16 b;
int32 a;
}
...
I'm writing grepath utility that finds executables in %PATH% that match a pattern.
I need to define whether given filename in the path is executable (emphasis is on command line scripts).
Based on "Tell if a file is executable" I've got:
import os
from pywintypes import error
from win32api import FindExecutable, GetLongPathName
def ...
I am porting some c++ code to c. What is a viable equivalent of std::map in c?
I know there is no equivalent in c.
This is what I am thinking of using:
In c++:
std::map< uint, sTexture > m_Textures;
In c:
typedef struct
{
uint* intKey;
sTexture* textureValue;
} sTMTextureMap;
Is that viable or am I simplifying map too much? ...
What is the easiest way to make Linux C++ GUI apps? I'm using GNOME and ubuntu 8.10.
...
I have an object(A) which has a list composed of objects (B). The objects in the list(B) are pointers, but should the list itself be a pointer? I'm migrating from Java to C++ and still haven't gotten fully accustomed to the stack/heap. The list will not be passed outside of class A, only the elements in the list. Is it good practice to a...
Im trying to get libcurl to download a webpage that is encoded in UTF-8, which is working fine, except for the fact that it converts it to ASCII and screws up some of the characters. Is there an easy way to get it to keep it in UTF-8?
...
#include<iostream>
using namespace std;
int main()
{
char again;
do
{
cout<<"you are in the while loop";
cout<<"do you want to continue looping?";
cin>>again;
}while(again!='n' || again!='N');
system("pause");
return 0;
}
i know something is wrong with the test condition in the 'while'. But i can't figure it out.
when the input o...
I recently wrote a class that renders B-spline curves. These curves are defined by a number of control points. Originally, I had intended to use eight control points, so I added a constant to the class, like so:
class Curve
{
public:
static const int CONTROL_POINT_COUNT = 8;
};
Now I want to extend this class to allow an arbi...
This MSDN article states that getcwd() has been deprecated and that the ISO C++ compatible _getcwd should be used instead, which raises the question: what makes getcwd() not ISO-compliant?
...
I'm a programmer with 2 years experience, I worked in 4 places and I really think of myself as a confident, and fluent developer.
Most of my colleagues have CS degrees, and I don't really feel any difference! However, to keep up my mind on the same stream with these guys, I studied C (read beginning C from novice to professional), Data...
For some reason I have only the linker map for an application I am debugging. There is a crash log which says crash occurred at offset "myApp.exe! + 4CA24".
From the linker map I am able to locate the method. Say this is at offset "myApp.exe! + 4BD7C".
Is there anyway to figure out the exact line in source code using just the above ...
How do I allow the STL implementation to pick up my custom types? On MSVC, there is a class std::tr1::hash, which I can partially specialize by using
namespace std
{
namespace tr1
{
template <>
struct hash<MyType>
{ ... };
}
}
but is this the recommended way? Moreover, does this work with GCC'...
After reading the faq's and everything else I can find, I'm still confused. If I have a char pointer that is initialised in this fashion:
char *s = "Hello world!"
The string is in read-only memory and I cannot change it like this:
*s = 'W';
to make "Wello world!". This I understand, but I can't, for the life of me, understand how to...
PROBLEM:
C:\>**cl /LD hellomodule.c /Ic:\Python24\include c:\Python24\libs\python24.lib /link/out:hello.dll**
'cl' is not recognized as an internal
or external command,
operable program or batch file.
I am using Visual Studio Prof Edi 2008.
What PATH should I set for this command to work?
How to execute above command us...
How do I convert between big-endian and little-endian values in C++?
I'm using VC++ 6.0.when I used _byteswap_ulong() function it requires the header file intrin.h.
When I include the header it reports an error saying incompatible compiler and that intrin.h is for the gcc compiler.
So is there any other functions to convert between big-e...
I need to create a simple windows app for my father's business that handles employee records that can be entered and retrieved though a search and output to excel or something similar. I was thinking of using C++ and using MySQL as the database. I want to make it as simple and seamless as possible, so I am completely open to suggestions ...
I am a C# programmer who started using ubuntu about 2 years ago. I'm wanting to learn GUI programming in either C or C++. I don't really like mono, it tends to crash on my system. I have a basic understanding of C++. I have never worked in C, but it looks cool. Which toolkit should I learn/use? Give Pro/Cons of each. Thanks!
...