Advice on coding problem, please... 
Author Message
 Advice on coding problem, please...

The following snippet of code is causing my Borland C++ 3/1 Compiler fits.

************Start of code
/*
We need to make sure all potential editting screen lines are empty by filling
them with EOF's. */
        for ( y = 0; y < MAX_EDITOR_LINE_CAPABILITY; y++ )
                for ( x = 0; x < MAX_FILE_LENGTH; x++ )
//              * ( CurrentRecordBrokenIntoLines [ y ] + x ) = '\0';
//              * ( * ( CurrentRecordBrokenIntoLines + y ) + x ) = '\0';
                CurrentRecordBrokenIntoLines [ y ] [ x ] = '\0';
************End of code

Whenever I run this little section of code, subsequent calls to
gotoxy () have no effect. I can't even see what the relationship is between
this section of code and gotoxy ()!

After Tracing to this code, if I try to force the compiler to finish this code by placing my
cursor in the editting window on the next line following this code then hitting the
"Run/Go To Cursor" key, the Borland compiler inexplicably (to me) takes me to the
User Screen ( where my program has previously drawn a screen with a text window)
and mildly locks up.

I can get out of the lockup by pressing Ctrl-Break. When I press Ctrl-Break, I end up
back in the middle of this code in some random place. For example, sometimes x = 5,
y = 1 and other times x = 6000, y = 30. There's no particular place in the code that I go
back to.

I declared RecordsSplitIntoLines as a char * [MAX_EDITOR_LINE_CAPABILITY],
where MAX_EDITOR_LINE_CAPABILITY = 50.  MAX_FILE_LENGTH = 6144.

You can see that I tried to replace the last line with some equivalent alternates. None of
them caused any effect.

What's going on here?

Jeff



Sat, 10 Jan 1998 03:00:00 GMT  
 Advice on coding problem, please...
: The following snippet of code is causing my Borland C++ 3/1 Compiler fits.

: ************Start of code
: /*
: We need to make sure all potential editting screen lines are empty by filling
: them with EOF's. */
:       for ( y = 0; y < MAX_EDITOR_LINE_CAPABILITY; y++ )
:               for ( x = 0; x < MAX_FILE_LENGTH; x++ )
: //            * ( CurrentRecordBrokenIntoLines [ y ] + x ) = '\0';
: //            * ( * ( CurrentRecordBrokenIntoLines + y ) + x ) = '\0';
:               CurrentRecordBrokenIntoLines [ y ] [ x ] = '\0';
: ************End of code

: Whenever I run this little section of code, subsequent calls to
: gotoxy () have no effect. I can't even see what the relationship is between
: this section of code and gotoxy ()!

: After Tracing to this code, if I try to force the compiler to finish this code by placing my
: cursor in the editting window on the next line following this code then hitting the
: "Run/Go To Cursor" key, the Borland compiler inexplicably (to me) takes me to the
: User Screen ( where my program has previously drawn a screen with a text window)
: and mildly locks up.

: I can get out of the lockup by pressing Ctrl-Break. When I press Ctrl-Break, I end up
: back in the middle of this code in some random place. For example, sometimes x = 5,
: y = 1 and other times x = 6000, y = 30. There's no particular place in the code that I go
: back to.

: I declared RecordsSplitIntoLines as a char * [MAX_EDITOR_LINE_CAPABILITY],
: where MAX_EDITOR_LINE_CAPABILITY = 50.  MAX_FILE_LENGTH = 6144.

: You can see that I tried to replace the last line with some equivalent alternates. None of
: them caused any effect.

: What's going on here?

Extreme chaos!



Sun, 11 Jan 1998 03:00:00 GMT  
 Advice on coding problem, please...

Quote:

>The following snippet of code is causing my Borland C++ 3/1 Compiler fits.

>************Start of code
>/*
>We need to make sure all potential editting screen lines are empty by filling
>them with EOF's. */
>        for ( y = 0; y < MAX_EDITOR_LINE_CAPABILITY; y++ )
>                for ( x = 0; x < MAX_FILE_LENGTH; x++ )
>//              * ( CurrentRecordBrokenIntoLines [ y ] + x ) = '\0';
>//              * ( * ( CurrentRecordBrokenIntoLines + y ) + x ) = '\0';
>                CurrentRecordBrokenIntoLines [ y ] [ x ] = '\0';
>************End of code

>Whenever I run this little section of code, subsequent calls to
>gotoxy () have no effect. I can't even see what the relationship is between
>this section of code and gotoxy ()!

>After Tracing to this code, if I try to force the compiler to finish this code by placing my
>cursor in the editting window on the next line following this code then hitting the
>"Run/Go To Cursor" key, the Borland compiler inexplicably (to me) takes me to the
>User Screen ( where my program has previously drawn a screen with a text window)
>and mildly locks up.

>I can get out of the lockup by pressing Ctrl-Break. When I press Ctrl-Break, I end up
>back in the middle of this code in some random place. For example, sometimes x = 5,
>y = 1 and other times x = 6000, y = 30. There's no particular place in the code that I go
>back to.

>I declared RecordsSplitIntoLines as a char * [MAX_EDITOR_LINE_CAPABILITY],
>where MAX_EDITOR_LINE_CAPABILITY = 50.  MAX_FILE_LENGTH = 6144.

>You can see that I tried to replace the last line with some equivalent alternates. None of
>them caused any effect.

It's not possible to say for sure, since this code fragment does not
compile. Based on the textual description that follows it, it may be that
there is no memory allocated for the char*'s contained in
RecordsSplitIntoLines, so the assignments to RSIL[y][x] are going into
more or less random places in memory. That rarely has a good effect on
program execution.
        -- Pete


Sun, 11 Jan 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. pointer to pointer problem, please advice

2. Advice please

3. C# reference advice please

4. please help / advice

5. Please Kindly Advice

6. I want to ask you All an advice, please

7. oops, book advice (please don't freak out :))

8. Please give me some advice about the relational error in database value and var

9. book advice - Please ???

10. Could you give me advice please,

11. Advice on Strings PLEASE....

12. winsock client/server advice please!!

 

 
Powered by phpBB® Forum Software