Click to See Complete Forum and Search --> : Access violation


Maestro
April 28th, 2003, 07:51 AM
Hi!

I use standard C.
I have a function that has a text(char*) parameter.
In the function I alter this text, and sometimes the size of the text grows. I have to return this altered text, but I get access violation.
Before I call the function I use malloc to allocate memory for the text.

How should I return the altered text when I want it in the function arguments(1. using the same input text variable, 2. with another argument), not as return value?
How and where should I allocate memory for the altered text?

Thanx

pim42
April 28th, 2003, 09:36 AM
since you are using C you can use realloc in your function to resize the memory allocation for your character string.