I just started trying to use OpenGL in C++ for a class(I have previously used it in Java a fair amount). And I started off trying to write something substantial, I couldn't get that to stop Seg faulting so I wrote this piddly little piece of code which is nearly a line for line copy from an example in the first chapter of the red book. ...
Suppose I have a bunch of C++ files: A.cc, B.cc, C.cc, and their associated header files. A.cc makes use of classes in B.cc and so on.
Now say I want to build the source files. After the preprocessing phase, can I theoretically compile (not link) all the files simultaneously? (A.cc -> A.obj, ...)
I'm just wondering if there is ever a ...
Hi everyone, I have an assignees that I've been working on and I'm stuck on the last function.
use the function void Increment(int numDays = 1)
This function should move the date forward by the number of calendar days given in the argument. Default value on the parameter is 1 day. Examples:
Date d1(10, 31, 1998); // Oct 31, 1998
Date ...
Is there any particular reason that the linking phase when building a project with distcc is done locally rather than sent off to other computers to be done like compiling is? Reading the distcc whitepages didn't give a clear answer but I'm guessing that the time spent linking object files is not very significant compared to compilation....
How could I search for a word in a certain file, and then replace that word with a different string of text. Like for example: In this paragraph find the word iPad and replace it with iPhone. I would like a code sample in C (or C++ if it is not possible without a third party library).
...
Hi,
I'm working on linux and am using the values in /proc//stat to log performance data. I am currently logging process user time and process system time. The problem that I have run into is that the code puts out correct values on ubuntu 10.04 but seems to be wrong under fedora 13.
Under fedora it looks like the counter for process us...
I'm currently writing an interactive simulator which displays the evolution of a system of particles. I'm developing on Windows 7 32-bit, using Visual Studio.
Currently, I have a function to draw all the particles on screen that looks something like this:
void Simulator::draw()
{
glColor4f(255, 255, 255, 0);
glBegin();
for ...
Hi guys,
I'm having trouble finding any examples of OpenGL ES 2 (C++) loading/displaying images. Been looking for last 3 hours but all I found so far is for iPhone or "Look Ma! A triangle!" or it's unbelievably complicated (at least for me).
I'm just looking for something super easy (for a not very smart person). All I need is to load ...
I wanted to experiment with stringstream for an assignment, but I'm a little confused on how it works. I did a quick search but couldn't find anything that would answer my question.
Say I have a stream with a dynamic size, how would I know when to stop writing to the variable?
string var = "2 ++ asdf 3 * c";
stringstream ss;
ss <<...
I have a static library, say mystaticlib.a. I want to see its contents, such as the number of object files inside it.
How can I do this on gcc?
...
With desperate battle with Boost.Asio, i met a lot of difficulties.
One of them is that i can hardly locate where the "boost::noncopyable errors" are!!
If i violate the noncopyable regulation accidently, IDE only shows me some errors in noncopyable.hpp or somewhere else but nowhere in my files.
I can only find errors by comment&uncomm...
I am struggling with the code from few days can anyone help
std::string str=uri_req1.substr(found+1);
char query[2000];
sprintf(query,"Insert into publish VALUES('%s','NO')",str);
I am getting following warnings and value is not inserted in the tables
warning: cannot pass objects of non-POD type ‘struct std::string’
through ‘...’; ca...
Alright so I am writing a function as part of a lexical analyzer that 'looks up' or searches for a match with a keyword. My lexer catches all the obvious tokens such as single and multi character operators (+ - * / > < = == etc) (also comments and whitespace are already taken out) so I call a function after I've collected a stream of onl...
In the switch-case statements declaration-with-initialization is invalid but declaration-and-then-assignment is allowed. As shown in the following code snippet.
What is difference between these two type of initializations from the compiler side? And why is the first type of initialization invalid and second type a valid one.
switch(va...
Hi,
I have created a treeview at runtime in MFC application , I have added few nodes to it now i want to do some stuff on click of nodes so how i can get click event of treeview ?
My code looks like this :
CTreeCtrl *m_ctlTreeview;
m_ctlTreeview = new CTreeCtrl ;
m_ctlTreeview->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP |
...
Hi,
I'm using the linux /proc//stat file to generate cpu usage information for an application. The issue that I have run into is that on Fedora 13 things seem to act strangely whlie on ubuntu 10.04 things behave as I expect them to.
Specifically:
on fedora the application logs more process system time by a ratio of 3:1
on ubuntu the ap...
Hi, i have a question about the function call in the following example:
int main()
{
int a, b;
cin >> a >> b >> endl;
cout << *f(a,b);
return 0;
}
So is *f(a,b) a valid function call?
Edit:: sorry for the errors, i fixed them now i'm a little tired
...
Recently in an interview i was asked a question to write a function which takes two character arrays(integers) as input and returns the output character array.
Function Signature:
char* find_sum(char* a, char* b)
How would one approach this?
Example scenario:
find_sum("12345","32142") = "44487"
Note:
The number of digits can be ...
according to this site
http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/
i have done following program which sorts strings
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char list[5][4]={"dat","mai","lik","mar","ana"};
int main(int argc, char *argv[])
{
int x;
puts("sortirebamde:");
...
Hi,
I was reading about the licensing of software and one question that came to my mind is that "how software detect the change in system time and block themselves if someone changes system time?". Since there is no other reference available(provided we don't have internet connection, otherwise we can use time servers as reference), how...