Thread: old c compiler project

  1. #16
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    Well, the idea sounded great BUT it did not work. I put a copy of the link to the file downloaded into file.io and tried to see if the link works. The file got deleted! Going back to the file.io site I then found out that as soon as someone downloads the file, it gets deleted. One time use only! It seems that if I put the zip file into file.io, the only thing that I can do is download it into a message post for the forum users to see. That I cannot figure how to do as I cannot see any way of downloading a file into a message post.

  2. #17
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    Try this one: My fixed version of your code
    Should be good for 7 days.
    The site is easyupload.io
    Last edited by john.c; 08-19-2023 at 01:41 PM.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #18
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    https://file.io/zuVzhLvd1xqT I will try to download my files once again, I hope this link works for the users of this forum.
    These are the files in my project that I've been posting about for the last several days. Hopefully, now everyone can see the code that I am talking about. I suppose that the above link will work as I just downloaded this zip file into file.io. I think. By clicking on this link, I think the file downloaded to file.io will now be downloaded into this post. But where, I have no idea, and who gets to view it, I have no idea what's going to happen.
    maxcy
    Last edited by maxcy; 08-19-2023 at 02:47 PM.

  4. #19
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    I will save this link! Meanwhile, I did go back and created an account on file.io and downloaded the zip file once again. This time I actually got the link to file.io into the post. See Aug 2023 post at 4:25 PM EST a few minutes ago, with the new link. Hope it works so the forum users can see my
    project files.
    maxcy
    Last edited by maxcy; 08-19-2023 at 02:37 PM.

  5. #20
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    I guess these old code books can be quite the pain to work with as I am now discovering! After finally getting this thing to compile, it still didn't work. Looking at it with the debugger I did find that a lot of the code opens a FILE using source_code and other sections opened the same file using code_file! And the file was never closed! Taking out the redundant code it now compiles and seems to work pretty well, but does not scan the parameter input file. Scratching my head I then found out that the file from the book code that was used as a parameter to open a file, was empty! Putting some code into it I now have a working project. So I guess using old book code is asking for a daunting task to use to learn code.
    maxcy / wt1v

  6. #21
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    Good idea! I searched through the rest of the chapter folders and did find that the code was changed. Now it is named FFILE!

  7. #22
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    I've gotten as far as chapter 8 in Ron Maks book and have got all the code through chap 7 compiled and running. A great learning experience to say the least!! Now I have a problem in chapter 8. This code has a .c file that makes a function prototype of a function that is nowhere defined in this file! Searching around all the folders, a good idea in this case, I did find another file that contains this function! This file has a couple of parameters that are declared extern in my current working directory. So it looks like the author originally intended to use this function from another file and had to use it's parameters from the other file by declaring them extern. I could cut and paste the function into my code and bring the externals also into the folder to fix the problem, or I could just put the other file into my working folder and let the compiler/linker fix it that way also. Any suggestions?
    maxcy/wt1v

  8. #23
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Quote Originally Posted by maxcy View Post
    I've gotten as far as chapter 8 in Ron Maks book and have got all the code through chap 7 compiled and running. A great learning experience to say the least!! Now I have a problem in chapter 8. This code has a .c file that makes a function prototype of a function that is nowhere defined in this file! Searching around all the folders, a good idea in this case, I did find another file that contains this function! This file has a couple of parameters that are declared extern in my current working directory. So it looks like the author originally intended to use this function from another file and had to use it's parameters from the other file by declaring them extern. I could cut and paste the function into my code and bring the externals also into the folder to fix the problem, or I could just put the other file into my working folder and let the compiler/linker fix it that way also. Any suggestions?
    maxcy/wt1v
    If you have a function in one .c file, that is then called in a second .c file, then you create a header file (a .h file) and #include that header file in both .c files, using double quotes, not angle brackets.

    Code:
    #include "sample.h"
    In that header files, you put all the extern function prototypes from all the .c files. That way, the compiler and linker can resolve all the references to the function definitions, and function calls!

    Any 'static" function prototype, definitions, and calls should remain in one .c file where they are used.

    This is basic with multiple file coding!

    I am not familiar with the book you are using.

    I have said the following many times before, and I stand by my recommendations:

    ------------------------------
    If you are attempting to learn from painfully inadequate online tutorials, YouTube videos, or some book claiming to teach you in a short time, then THROW THEM AWAY!

    Short of taking a course in C Programming from a qualified instructor, you need to study a good book on the C Programming Language, cover to cover, and do all the exercises at the end of each chapter! Choose one of the three listed below:

    C Programming, A Modern Approach, 2nd Edition
    Author: K. N. King

    C Primer Plus, 6th Edition
    Stephen Prata

    C How to Program, 8/e
    Deitel & Deitel

    Studying one of these books, and writing code, you will have a much better understanding of the C Programming language.

  9. #24
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Of course, if you have .c files in different directories, that are used to create one program, then you have other issues.

    Without seeing the directories, possible libraries, and possible make files, I can't comment further, as well seeing the book itself.

  10. #25
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    One of the first things I did when putting this code together was to copy and paste all the relevant files into one directory! Each project is completely standalone!!
    maxcy

  11. #26
    Registered User
    Join Date
    Aug 2023
    Posts
    45
    I read Deitel & Deitel: too elementary. Besides I have an MS in computer science, so I am not a total novice. And I find it a lot more instructive to make my own example code and look at book code, even if it is older, than just reading from one book which usually has example code to fool with. The code is all in one folder!
    maxcy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 01-28-2016, 02:43 PM
  2. Replies: 4
    Last Post: 08-02-2013, 06:45 PM
  3. Replies: 5
    Last Post: 02-23-2013, 03:37 PM
  4. Replies: 2
    Last Post: 02-04-2008, 02:34 AM
  5. your 11th & 12th grade c++ project or similar project
    By sleepyheadtony in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 01-13-2002, 05:14 PM

Tags for this Thread