-
Wierd Text from File
ok I got a new problem after the Dbl Link list was solve.
The moving from one node to another and back works perfectly.
now the problem is the information retrieve from the file.
for example, after I retrieve information form the file into the node when I ask to display the information in the node I got an a bunch of wierd text and the system bleeping.
however, it only applies to string type. I tried the same returning an integer and displaying on screen and it works fine.
then I tried setting the string (say fName) to another string and return it, it works fine.
It only Happens when I try to access the fName, a string, which obtian its information from a file.
any idea?
-
My guess (as you haven't supplied source code that illustrates your problem) I'm guessing The problem is probably in the code that reads the string from the file. I realise that is not the code exhibiting the problem, but a basic rule is "the cause of a visible problem can be any code that is executed BEFORE or WHEN the problem becomes obvious". Three possibilities I can think of;
1) If your list has a member which is a pointer to char, you are forgetting to allocate something for the pointer to point at.
2) You are either overrunning a buffer or forgetting to add a zero terminating character to your string.
3) You are forgetting to check for end-of-file, and continuing to read past EOF, and therefore inserting garbage into your string (the characters obtained if you continue reading after EOF are unspecified).