Forum: C Sep 10th, 2007 |
| Replies: 9 Views: 1,587 You can only access an object if it was declared in the same scope or an enclosing scope. That's the techno babble explanation. :) What it means is that if you declare something inside a loop, you... |
Forum: C Sep 4th, 2007 |
| Replies: 7 Views: 1,241 You write a C callable wrapper that runs the method.
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
class Split { |
Forum: C Aug 31st, 2007 |
| Replies: 8 Views: 1,190 I don't know. It looks like CreateRawDataBUFR is corrupting your object, but you didn't post the logic for CreateRawDataBUFR. Without the code I can't even guess where you went wrong. |
Forum: C Aug 29th, 2007 |
| Replies: 17 Views: 2,255 system is in stdlib.h, not stdio.h. It's not a good idea either because now you depend on an outside program that might be malicious. It's a big security no-no because you created a hole that hackers... |
Forum: C Aug 29th, 2007 |
| Replies: 17 Views: 2,255 Doesn't printing \n do the same thing as fflush? |
Forum: C Aug 28th, 2007 |
| Replies: 17 Views: 2,255 The window gets destroyed when the program ends. If you call getchar so that it blocks for input, the program doesn't end and the window isn't destroyed until getchar returns. |
Forum: C Aug 21st, 2007 |
| Replies: 11 Views: 1,768 All of the memory for the stack is preallocated. The OS allocates it when the program starts and frees it when the program ends, but while the program is running, it's all still there. Going in and... |
Forum: C Aug 21st, 2007 |
| Replies: 11 Views: 1,768 No, it doesn't. But you _do_ lose the only reference to the space you had, and that's called a memory leak because now it's allocated and won't be freed until the program ends. If your OS doesn't... |
Forum: C Aug 2nd, 2007 |
| Replies: 8 Views: 17,639 You need to include stdlib.h. The error cryptically tells you that malloc wasn't declared and the compiler just assumes it's a function that returns int and casting from int to char* isn't friendly. |
Forum: C Jul 30th, 2007 |
| Replies: 14 Views: 3,845 Try dividing by 10 until the number as an int equals 0.
float temp = net_pay[i];
while ( (int)temp > 0 ) {
temp /= 10;
}
printf( "Before the radix -- %f\n", (float)(int)net_pay[i] );... |
Forum: C Jul 18th, 2007 |
| Replies: 11 Views: 2,905 I read about a trick that makes everything together. Move the PreDefStruct member to be last, make it an array of 1, and then make the APISTRUCT variable dynamic. If you allocate the size of... |
Forum: C Jul 17th, 2007 |
| Replies: 11 Views: 2,905 Does this work for you?
#include <stdio.h>
typedef struct tagPredefinedStruct{
int iSize;
int iCount;
} PREDEFINEDSTRUCT;
typedef struct APIStruct { |
Forum: C Jul 17th, 2007 |
| Replies: 11 Views: 2,905 Check the pointer to see if it's 0. If it is then malloc failed to allocate the memory.
You can't. Array sizes have to be constant and they can't be changed. A variable sized array is what I... |
Forum: C Jul 17th, 2007 |
| Replies: 11 Views: 2,905 You can't set the size of an array at run time. You have to dynamically create the array from a pointer.
typedef struct tagPredefinedStruct{
int iSize;
int iCount;
} PREDEFINEDSTRUCT;... |