I guess the best way to do that in C would be to read the entire line, separate spaces with strtok, and then read only the first letter of each token.
Back to my original question though - how do...
Type: Posts; User: Alexander Edgar
I guess the best way to do that in C would be to read the entire line, separate spaces with strtok, and then read only the first letter of each token.
Back to my original question though - how do...
Oops! T.T. I think this would work the way I want but I haven't tried it:
char v[2];
scanf("%[^' '] %c", &v[0], &v[1]);
Anyway that just further verifies I need to learn to do this, lol
Sorry about the wrong thingamajigs and the lack of proper description. That was just example code to quickly show what I'm looking for.
What I'm actually doing is a loop on both x and y and I...
I'm transitioning from C to C++ and am apparently having issues with certain things. In my C code, I have something that looks like this:
char grid[2][2];
for(int y=0; y<2; y++)
{
...
I'm trying to read the pixel at the user's cursor when they right click on a triangular gradient, but glReadPixel is only returning black. If I make it a flat color instead of a gradient, it works,...
Ah! That makes sense, thank you very much.
As a kind of follow up - if I was going to try to send the same data over a network, how would the server/client know that it's receiving a cMap...
I'm writing a certain class (the specifics don't really pertain to my question) to a file like so
fwrite((void*)&Map[MapID], sizeof(cMap), 1, fp);
And I read it later like so
Will gcc's deconstructor still run if the program crashes (due to a segfault or whatever else), or only on a successful exit or end of main?
Thanks whiteflags, that worked! Also, in regards to iMalc: Would the right way to use realloc look something like this?
if(ID == -1)
{
ID = numInterfaces;
cInterface* newface =...
So I switched to new and delete, but I didn't find a good replacement for realloc. Is there a way to do something similar without having to rewrite my entire program to use std::vector? I tried using...
I use a std::string inside of a class I allocate dynamically, and I crash or get segfaults whenever I try to use the string. I assume I'm not initializing it right somehow, but I don't know what to...
Forgot to mention that although the font looks like it has an outline, that's just part of the font. The actual true-type font looks like that, haha. Also, I can end up with it looking like this...