Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Pointer problems

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
In the following two lines<br>strcpy(NewFile,FCurrent-&gt;AByte);<br>FCurrent = FCurrent-&gt;next;<br><br>I get an error, well the first line goes by fine the first time. I have a breakpoint on both, right after the first executes, the address of FCurrent and FHead become<br>0x00000003 and 0x00000080<br><br>there is no other procedure run other than strcpy, and naturally since the memory addresses are not correct this would cause the second line to crash, problem is, why is it chaning my addresses when it copies a charater array? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)
 
What was the type of FCurrent and NewFile? I may help you here but need to know a litte bit further about the type you defined for both variables mentioned.<br><br>Blue Jacket
 
Please send your code. It seems that there is some pointer confliction.<br>Thanx<br>siddhartha Singh<br><A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A><br>
 
I got it ok, far as the pointer thing goes, I made my own string copy which is just a loop copying over each char, which is what its supposed to do since its binary data (in strcpy it malnipulates or makes the copy how it feels, for example if the first char is a 0 , it terminates the string and makes it a &quot;&quot; instead of continueing on) the pointer prob later, when it kept crashing when freeing up all the nodes, was because the char array being held in each node wasnt properly terminated at the end. Now i' trying to figure out how yo use SafeArray so i can copy the linked list into it, then export it outo VB(you'll see my other posts) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top