Computers, Consoles and I.T. Post all computer related chat in here for our I.T techies to help with. Please be aware that any discussions related to piracy will be removed and render the member liable to a possible ban. Piracy renders PassionFord Admin liable for prosecution, as well as its members.

C Programming Help

Thread Tools
 
Search this Thread
 
Old Nov 4, 2008 | 06:24 PM
  #1  
sailorbob's Avatar
sailorbob
Thread Starter
Too many posts.. I need a life!!
 
Joined: Jan 2005
Posts: 888
Likes: 3
Default C Programming Help

Can anyone help with the following problem? I am trying to fix a problem in some code and, being a complete novice with no C programming experience I am probably missing the obvious. Below is the section that is causing the problem; the code compiles OK but when you run the program it is baulking at the for statement and skipping the rest of the code.

Code:
/* output the predefined special function registers                                      */
    sp = predef_sfr;
    for(i = 0; i < sizeof(predef_sfr) / sizeof(PREDEF_SFR); ++i)
    {   memset(outp, ' ', 79);
        if((sts = format_addr20(sp->sfr_addr, &outp[COL_PC])) < 0) /* put value in 1st 5 chars */
            return(sts);
        memcpy(&outp[20], sp->sfr_name, strlen(sp->sfr_name) );
        memcpy(&outp[54], "equ", 3);                            /* put SFR name in output    */
        outp[60] = '$';
        if((sts = format_addr20(sp->sfr_addr, &outp[61])) < 0)
            return(sts);
        outp[66] = '\0';                                     /* pull null termination in output */
        output_line(file_ptr_output, showhex, spacer_line, outp);
        ++sp;
    }
I think it is the second expression that is the cause of the problem where the loop should be comparing the loop counter with the total length of a structure. I'm sure that more info will be required to help understand the code snippet so just ask and I'll try to answer.

Thanks in advance.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Iain Mac
General Car Related Discussion.
0
Sep 13, 2015 09:16 PM
Bailes1992
Restorations, Rebuilds & Projects.
4
Sep 3, 2015 02:17 PM
Stu @ M Developments
General Car Related Discussion.
41
Aug 21, 2015 06:47 AM
Bailes1992
General Car Related Discussion.
4
Aug 16, 2015 07:14 PM




All times are GMT. The time now is 06:27 PM.