CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    19

    Access violation

    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

  2. #2
    Join Date
    Jan 2003
    Posts
    159
    since you are using C you can use realloc in your function to resize the memory allocation for your character string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured