User Profile

Collapse

Profile Sidebar

Collapse
hpmachining
hpmachining
Last Activity: Feb 4 '20, 08:04 PM
Joined: Oct 1 '15
Location: Interlochen, MI
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • If both columns are the same length, zip will work well. If columns are different lengths, the output will stop when the end of the shorter column is reached. Here is an example that prints to the screen.
    Code:
    columnA = ["aa", "bb", "cc", "dd", "ee"]
    columnB = [12, 23, 34, 45, 56]
    
    for a, b in zip(columnA, columnB):
        print('{}, {}'.format(a, b))
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to SFML setup errors
    in C
    You're welcome. I'm not sure why you have to run CodeBlocks with administrator rights, though. Can you run the program by double clicking it from the file explorer in Windows? Just curious.
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to SFML setup errors
    in C
    Ok, I confirmed that this version of SFML:
    SFML 2.4.0 GCC 4.9.2 TDM (SJLJ) - 32-bit

    works with the gcc that is installed in CodeBlocks at this link:
    codeblocks-16.01mingw-setup.exe

    When I installed CodeBlocks from that link, I also had both versions of the libraries in the MinGW directory, but as long as I built against the SFML version in the link I provided it worked. I only get the errors you get when...
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to SFML setup errors
    in C
    I don't know why you have both. I would suggest you download the appropriate version that matches the SFML version you downloaded, and either rename your old MinGW directory to MinGW.backup, or whatever you want, then install the version that matches SFML, or you can install the new MinGW to a directory with a different name, such as MinGW-SFML and configure CodeBlocks to use it instead of the original.
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to SFML setup errors
    in C
    It looks like you may be using a different version of MinGW gcc than SFML was built with. The "undefined reference to `_Unwind_Resume '" linker errors happen when mixing SJLJ and DW2 exception handling methods. Check this page to make sure you get the exact compiler and SFML versions:
    http://www.sfml-dev.org/download/sfml/2.4.0/
    Right below the SFML downloads are links to the MinGW compilers that were used for the libraries....
    See more | Go to post

    Leave a comment:


  • You can look thru the release notes for each version here: Boost Version History
    See more | Go to post

    Leave a comment:


  • If head is some garbage value, I am thinking the p->next=head line will be assigning an invalid address to p->next. I could be wrong, but you could try setting head to NULL before entering the loop to see if it fixes it. I tried your program with Visual Studio and GCC. VS wouldn't compile without initializing and GCC didn't give me the seg fault, so I can't say for sure if that is the problem.
    See more | Go to post

    Leave a comment:


  • I know this is an old question but I wanted to take a shot at it. Here is what I came up with:
    Code:
    #!/bin/bash
    farr0=("##### " "    # " "##### " "##### " "#   # " "##### " "#     " "##### " "##### " "##### " "    # " "     ")
    farr1=("#   # " "    # " "    # " "    # " "#
    ...
    See more | Go to post

    Leave a comment:


  • You are not initializing head. It is probably not NULL when the program enters the for loop.
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to Increment and decrement
    in C
    What you have is undefined behavior. The order in which function arguments are evaluated is unspecified in the standard, so how they are evaluated is compiler specific. Here is a link to Kernigan & Ritchie. See chapter 2.12, (specifically page 49) for an example similar to yours.
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to Basic struct serialization operation on C
    in C
    I see a couple of things in serialize. First, you have already allocated space on the stack in main for data so don't use malloc. Second, sizeof(message) returns the size of the pointer, not the size of the data it points to. To get the size of the data you can use sizeof *message instead. The following should work for serialize:
    Code:
    void serialize(cloudMessage *message, char *data)
    {
      assert(data != NULL);
      memcpy(data,
    ...
    See more | Go to post

    Leave a comment:


  • First off, you won't be able to get a string with spaces using std::cin like that. It will only get the first word. Instead use std::getline. Then one way to to get the individual words is with std::stringstre am, which allows a string to be treated as a stream.
    Code:
    #include <iostream>
    #include <string>
    #include <sstream>
    #include <vector>
    
    int main(void)
    {
      std::string input;
    ...
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to Error:D8021 Visual Studio 2013
    in C
    How are you defining _CRT_SECURE_NO_ WARNINGS? Make sure it is not defined anywhere in your code, then go to Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions and add _CRT_SECURE_NO_ WARNINGS. Then go to Project Properties -> Configuration Properties -> C/C++ -> Command Line and look at in the All Options box and see what is there. Among the options you should see /D "_CRT_SECURE_NO _WARNINGS"....
    See more | Go to post

    Leave a comment:


  • hpmachining
    replied to Error:D8021 Visual Studio 2013
    in C
    I would recommend you use wcscat_s as the warning recommends.

    Code:
    wcscat_s(CustomFile, MAX_PATH, lpFileName);
    Otherwise, you need to define _CRT_SECURE_NO_ WARNINGS. You can do this by right clicking on your project and select Properties->C++->Preprocessor and add it to the definitions.
    See more | Go to post
    Last edited by hpmachining; Oct 22 '15, 04:14 PM. Reason: I removed the part about not tested. I have since tested.

    Leave a comment:


  • hpmachining
    replied to Error:D8021 Visual Studio 2013
    in C
    Where (and how) are you trying to use _CRT_SECURE_NO_ WARNINGS?
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...