Forum: C++ Jul 27th, 2009 |
| Replies: 5 Views: 519 Thanks, but what about for Linux?
I also couldn't find any references or docs online for GetAKeySyncState(), and when I try to compile (after including windows.h) on my Windows machine I get |
Forum: C++ Jul 26th, 2009 |
| Replies: 5 Views: 519 How would one listen for keyboard input, without causing the program to pause waiting for the input? For instance say you have something like
float num = 0;
bool runloop = true;
for(int i=0;... |
Forum: C++ Jul 14th, 2009 |
| Replies: 0 Views: 424 I have LAPACK and am having problems trying to compile while linking to it with g++ (MinGW and MinGW 64, have and tried both) using the following command:
g++ main.cpp -I"C:\Program Files... |
Forum: C++ Jul 9th, 2009 |
| Replies: 6 Views: 805 That works. So I guess #ifdef can't do and/or, you have to use defined. Thanks. |
Forum: C++ Jul 9th, 2009 |
| Replies: 6 Views: 805 I'm using MinGW. I checked and WIN32 and _WIN32 both evaluate as true for me.
So this syntax is actually OK? Because the following gives me "warning: extra tokens at end of #ifdef directive"... |
Forum: C++ Jul 9th, 2009 |
| Replies: 6 Views: 805 Is it possible to use #ifdef with Boolean AND and OR? For instance something like
#ifdef WIN32 || WIN64
cout << "This is Windows." << endl;
#endif
The above doesn't give a compiler error for me,... |
Forum: C++ Jul 7th, 2009 |
| Replies: 11 Views: 924 It was a 32 bit/64 bit issue. I had a ton of problems updating Visual Studio (got some real weird errors... |
Forum: C++ Jul 5th, 2009 |
| Replies: 11 Views: 924 (edit: whoops, you posted as I was reading that vcvarsall stuff :) I'll check out that link)
Thanks. The version I have is the Professional Edition. How do I use the 64-bit compiler? Do I change a... |
Forum: C++ Jul 5th, 2009 |
| Replies: 11 Views: 924 I'm having a lot of trouble finding enough RAM for a program I'm writing on Vista 64 Ultimate system, even though the system has 8GB RAM and only 2GB is used.
I tried to see how many 10 million... |
Forum: C++ Sep 4th, 2008 |
| Replies: 5 Views: 1,255 Sounds like a good idea, but unfortunately I'm not familiar with threading.
Thanks a lot Ancient Dragon, that solution works :) |
Forum: C++ Sep 2nd, 2008 |
| Replies: 5 Views: 1,255 I have a class that has functions which use <stdio.h> and <stdarg.h> to take in indefinite arguments, and one of the member functions taking in filenames. There's another function (call it the "do"... |
Forum: C++ Aug 20th, 2008 |
| Replies: 16 Views: 1,816 Thanks, I made those changes and it worked :)
I also tried using va_copy, like below, and that also worked. Don't know if one method is more proper than the other:
void battleShip(int n,...){
//... |
Forum: C++ Aug 19th, 2008 |
| Replies: 16 Views: 1,816 I have another question regarding this.
I didn't realize that you could pass the first argument as an int regardless of what the other arguments are. But, how does one pass indefinite arguments... |
Forum: C++ Aug 8th, 2008 |
| Replies: 16 Views: 1,816 Is there a coding reason why it would be preferable to use "const char *" instead of just "char *"?
Odd, when I run your code it outputs just "One!.." "Two!.." "Three!..", without the "Air-raid... |
Forum: C++ Aug 5th, 2008 |
| Replies: 16 Views: 1,816 Thank you :)
Just to note, it seems you have to manually use the first argument.
#include <stdarg.h>
#include <iostream>
using namespace std;
void battleShip(const char* what,...)
{
... |
Forum: C++ Aug 4th, 2008 |
| Replies: 16 Views: 1,816 Thanks. How does one access the C string arguments then? For example how would one get 'void test_args(int arg_count, char* cur_s, ...){}' to display each C string with 'test_args(3, "hello", " ",... |
Forum: C++ Aug 2nd, 2008 |
| Replies: 16 Views: 1,816 How does one do this with strings or other types than ints?
For instance something like,#include <iostream>
#include <stdio.h>
#include <stdarg.h>
using namespace std;
void... |
Forum: C++ Jun 21st, 2008 |
| Replies: 3 Views: 1,822 Thank you very much, I didn't realize it would be that complicated to read with fgetc(). You're right, fread() is much better :) |
Forum: C++ Jun 21st, 2008 |
| Replies: 3 Views: 1,822 Can getc()/putc()/fgetc()/fputc() be used to read/write chars and floats rather than ints only from binary files? If so, how? |
Forum: C++ Jun 16th, 2008 |
| Replies: 2 Views: 725 Thanks, that works.
So you need the & in int& operator[]... in order to be able to alter, but not to access, as you can only alter if it returns a reference; took me a bit to understand that. |
Forum: C++ Jun 16th, 2008 |
| Replies: 2 Views: 725 The vector class provides access and altering uses brackets, e.g. v[5]. How can I make a class that can do the same? e.g. given Class Test object t, t[5]=... |
Forum: C++ Jun 15th, 2008 |
| Replies: 16 Views: 1,816 I believe indefinite arguments can be defined with '...', but then how do you access them? For instance for the following function:
int test(int n, ...){
return n;
} |
Forum: C++ Jun 13th, 2008 |
| Replies: 4 Views: 1,396 Thank you, I realized my mistake - I had been doing:
int combined = i << 8 | j;
Instead of:
int combined = i << 24 | j;
williamhemswort, I am using Linux :)
A related question - for int,... |
Forum: C++ Jun 13th, 2008 |
| Replies: 4 Views: 1,396 I'm trying the following code to combine ints, and then get the original ints back:
#include <iostream>
using namespace std;
int getleft(int n){
return (n >> 24);
}
int getright(int n){ |
Forum: C++ Jun 8th, 2008 |
| Replies: 4 Views: 1,691 Another question: what is the purpose of the ios::binary flag? When I try it, the output and input is always binary, even if the flag is omitted and other flags like ios::app are used instead. |
Forum: C++ Jun 8th, 2008 |
| Replies: 4 Views: 1,691 Yes that worked, thanks :) |
Forum: C++ Jun 8th, 2008 |
| Replies: 4 Views: 1,691 I'm trying to use fstreams to read and write binary data to a file with the following code:
#include <fstream>
#include <iostream>
using namespace std;
int main(){
ofstream out("test.data",... |
Forum: C++ May 29th, 2008 |
| Replies: 7 Views: 1,794 Thank you, so this is just a special shorthand for char arrays.
Is there any programming reason why I always see function definitions with arguments like this:
char getchar(char *arr){
Instead... |
Forum: C++ May 28th, 2008 |
| Replies: 7 Views: 1,794 Ah I see, yes that works.
However I still don't understand the use of the * operator in the context of declaring arrays. |
Forum: C++ May 28th, 2008 |
| Replies: 7 Views: 1,794 I'm confused about the use of the dereference operator in the declaring of char arrays.
I think I understand that the dereference operator is used to dereference memory addresses to their values,... |
Forum: C++ May 24th, 2008 |
| Replies: 1 Views: 576 Are there any functions to calculate, or common techniques to estimate, how much memory a C++ script is consuming at a given moment/place in the code? Maybe some built-in function that keeps track of... |
Forum: C++ May 23rd, 2008 |
| Replies: 8 Views: 2,922 Turns out that the Makefile had some incorrect settings, in terms of where mysql is located on my server:
INSTALL_PREFIX = /usr/devel
INCLUDE = -I/usr/devel/include
LIBS = ... |
Forum: C++ May 20th, 2008 |
| Replies: 8 Views: 2,922 Thanks. Though I don't think there's any real documentation to MySQLWrapped (the readme links to a defunct website), and while the developer's (http://www.alhem.net/project/mysql/) site has examples... |
Forum: C++ May 20th, 2008 |
| Replies: 8 Views: 2,922 I'm trying out MySQLWrapped, but am having a strange problem that I can't figure out. After downloading mysqlwrapped-1.6.tar.gz, running 'make' and mimicing the MySQLWrapped example... |
Forum: C++ May 12th, 2008 |
| Replies: 1 Views: 457 Is there any difference between regular expressions in C++ and in PHP/Perl? Or can one use the same regular expressions in C++ as in PHP? |
Forum: C++ May 10th, 2008 |
| Replies: 8 Views: 2,922 Thank you.
Do others have any suggestions or tips? |
Forum: C++ May 10th, 2008 |
| Replies: 8 Views: 2,922 I'm a C++ beginner. What's an easy to use (in terms of both installation and use in code) library for using MySQL in C++? Is there one that's a lot more commonly used than others? Note that I'm using... |