Search Results

Showing results 1 to 14 of 14
Search took 0.01 seconds.
Search: Posts Made By: Hamrick ; Forum: C and child forums
Forum: C Sep 10th, 2007
Replies: 9
Views: 1,587
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Solved: Stupid Question
Views: 2,255
Posted By Hamrick
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
Solved: Stupid Question
Views: 2,255
Posted By Hamrick
Doesn't printing \n do the same thing as fflush?
Forum: C Aug 28th, 2007
Replies: 17
Solved: Stupid Question
Views: 2,255
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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;...
Showing results 1 to 14 of 14

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC