I’m new to Linux & codeblocks. When building the code below i receive this error:
“segmentation fault process returned 139 (0x8b)”
I know it has something to do with memory but I cannot find the problem. While compiling the files with a Makefile or separately in the terminal I don’t receive any errors.
The main receives 2 arguments (argv) ComputersInNet.txt - > argv[1] Simulation.txt -> argv[2]
AND I cannot figure out how I add these files to the project using codeblocks, ALSO in Windows (Visual Basic) the codes works perfectly.
I couldn’t paste the codes correctly (5 files: 2 .h and 3 .cpp) you can download them from the link below, including both txt files I use as arguments.
The code snippet problem is occured, subroutine
Create_PC_List()is invoked frommain()to create a list of computers.Output:
We could see
fopen()failed with error"No such file or directory". Therefore, you need find a way to add three text files to Code Blocks an made available forfopen().Secondly reason for the segmentation fault is fp provided to
getc()is aFILE *pointer containing a NULL address that is not a valid FILE object.