I'm using ODBC and C++ against SQL Server 2005 (native client).
I have the following simple test stored procedure that returns two rows of constant values:
CREATE PROCEDURE usp_testme AS BEGIN
declare @details table( one int, two int, three int, four int )
insert @details SELECT 1 one, 2 two, 3 three, 4 four UNION SELECT 5, ...
In Python I can use re.findall(pattern, string) to return all non-overlapping matches of pattern in a string.
For example, in the following SVG path command:
import re
spam = "M317.0,169.7C311.1,170.5 285.7,146.8 300.7,178.57 L 321.4,175.01"
eggs = re.findall("([A-Za-z]|-?[0-9]+\.?[0-9]*(?:e-?[0-9]*)?)", spam)
print(eggs)
['M', '317.0'...
Haven't used C++ in a while. I've been depending on my Java compiler to do optimization.
What's is the most optimized way to do a for loop in C++? Or it is all the same now with moderm compilers? In the 'old days' there was a difference.
for (int i=1; i<=100; i++)
OR
int i;
for (i=1; i<=100; i++)
OR
int i = 1;
for ( ; i<=100...
Hi my program saves some settings (mostly string) to a text file, to retrieve them later, but alas! The special characters come back unrecognizable!
saveSettings saves the strings one by one...
void email::saveSettings(string filename){
ofstream savefile(filename.c_str(),ios::out | ios::trunc);
email settingsemail(this);
s...
How do I force my application to wait until WinExec has completed?
...
Hi there ,
i am more a java developer and there is a standard way of reading images :
BufferedImage img = null;
try {
img = ImageIO.read(new File("strawberry.png"));
} catch (IOException e) {
}
but what is the c++ way of loading images?
I want to load all images in a specific directory into an array or so
Can somebody help ...
I've never quite understood how the argument lists for operator overloading are determined in a systematic way, and I'm particularly confused by a problem I have now.
When you overload a unary operator it has one argument, or zero if it's a class member. When you overload a binary operator it has two arguments, or one if it's a class m...
I have a container of smart pointers to mutable objects. I have to write two *for_each* loops, one for accessing the objects as read-only data and another for mutable data. The compiler is telling me that std::vector< boost::shared_ptr<Object> > is not the same as std::vector< boost::shared_ptr<const Object> >, note the const.
Here ...
In every language that I can think of, except C++, the function Replace essentially replaces all pieces of a string, whereas C++'s string class does not support simple operations like the following:
string s = "Hello World";
s = s.Replace("Hello", "Goodbye");
echo s; // Prints "Goodbye World"
This seems the most common use of any type...
I know technically the std::basic_string template is not required to have contiguous memory. However, I'm curious how many implementations exist for modern compilers that actually take advantage of this freedom. For example, if one wants code like the following it seems silly to allocate a vector just to turn around instantly and return ...
I'm using the sqlite3 library in c++ to query the database from *.sqlite file. can you write a query statement in sqlite3 like:
char* sql = "select name from table id = (select full_name from second_table where column = 4);"
The second statement should return an id to complete the query statement with first statement.
...
I have a compiler that targets the .NET runtime (CLR). The current version of the compiler is written in standard C++ (non-managed). The compiler currently lacks support to reference assemblies at compile time, so the way I "import" .NET libraries is with a utility stub generator that is written in .NET, which reflects any assembly and e...
I'm building a very small C/C++ project using eclipse and i'm getting the following during build:
make all
Building file: ../Metric.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/include/glib-2.0 -I/usr/include/libgtop-2.0 -I/usr/lib/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Metric.d" -MT"Metric.d" -o"Metric.o" "../M...
In Qt, how can I convert a typed collection of objects such as a QList<T> into a QList<QVariant>? I suppose I could construct a new list and copy the elements over, converting each to a QVariant along the way, but is there a shortcut?
...
Hi
Could someone please help with this? I have the following:
// part_1
if (pthread_create(&threadID, NULL, ThreadMain,
(void *) clientSocket) != 0) {
cerr << "Unable to create thread" << endl;
exit(1);
}
// part_2
void *ThreadMain(void *clientSocket) {
pthread_detach(pthread_self());
...
delete (TCPSocket *) c...
Hi
I would like to make the user input a center number of character, e.g. 10, however, the user might input more than 10.
for(int i = 0 ; i< 10 ; i++)
cin>>x;
The extra character could make my code crash since I will ask for input later.
How can I clear the input at this moment when the user input more than 10?
Thanks so much!
...
hi
Could someone please tell me if this is possible in C or C++?
void fun_a();
//int fun_b();
...
main(){
...
fun_a();
...
int fun_b(){
...
}
...
}
or something similar, as e.g. a class inside a function?
thanks for your replies,
...
When i use mtrace in my c++ programme,i get output like the following
Memory not freed:
Address Size Caller
0x0804a3c8 0x4 at 0x400b159f
How do i know where in the code is 0x400b159f?
...
How to create a directory with C code (other than the method of forking and using mkdir) ? Is there anything like dirent.h? dirent.h only allows to read directories. (without using external library)
...
Possible Duplicate:
Delete folder with items
How to delete a non empty directory in C or C++? Is there any function? rmdir only deletes empty directory. Please provide a way without using any external library.
Also tell me how to delete a file in C or C++?
...