~homsar47's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
31 (0.04 per day)
Joined:
06-October 13
Profile Views:
728
Last Active:
User is offline Dec 30 2015 12:43 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Classic
Your Car:
Who Cares
Dream Kudos:
0
Icon   ~homsar47 was raised by a cup of coffee

Posts I've Made

  1. In Topic: CoffeeScript: giving simple child_process output

    Posted 27 Dec 2015

    Update, I got a little creative and found a way to not only fix the problem, but to add more options to using the cakefile. There's two tasks, assemble and link. Both of these just use exec to do one program, and the program naturally waits for the exec to finish before it exits.

    There's also an option called build that uses execSync to do both of these. The "at" tree of errors from before gets suppressed, fixing the problem in a nice way. I'm happy. :bananaman:

    ###
    cakefile to build pong game.
    
    running it is just like a makefile.
    
    to assemble: cake assemble
    to link: cake link
    to assemble and link: cake build
    to clean up build files: cake clean
    ###
    
    fs = require 'fs'
    {exec} = require 'child_process'
    {execSync} = require 'child_process'
    
    delete_file = (file) ->
      fs.exists file , (existent) ->
        if existent
          fs.unlink file
    
    
    task 'assemble', ->
      # run the assembler
      exec 'wla-z80 -o pong.asm pong.o', (err, stdout, stderr) ->
        process.stdout.write stdout if stdout
        process.stderr.write stderr if stderr
    
    
    task 'link', ->
      fs.openSync 'linkfile', 'w' # truncate linkfile
      fs.writeFileSync "linkfile", "[objects]\npong.o" # write to linkfile
    
      # run the linker
      exec 'wlalink -vd linkfile pong.sms', (err, stdout, stderr) ->
        process.stdout.write stdout if stdout
        process.stderr.write stderr if stderr
    
    task 'build', ->
      execSync 'cake assemble'
      execSync 'cake link'
    
    # clean just gets rid of pong.o and linkfile.
    task 'clean', ->
      delete_file('linkfile')
      delete_file('pong.o')
    
    
  2. In Topic: If File Can Be Created?

    Posted 10 Apr 2014

    I feel so stupid right now.

    I used the catch (Exception e) and turns out, I was actually giving valid path names, but thought I wasn't because I forgot about the working path. Guess I wasn't thinking and so decided not to try invalid symbols until now.

    Thanks for the help! All is well for now. ;)
  3. In Topic: If File Can Be Created?

    Posted 9 Apr 2014

    I tried using:
    bool IsFileValid = true;
    try
    {
    System.IO.File.Create (s);
    } catch  {
    FileIsValid = false;
    }
    if (FileIsValid == false)
    {
    Console.WriteLine ("ERROR: {0} != valid file.", s);
    return 1;
    }
    
    


    To find the same result.
  4. In Topic: C - searching for string inside string results in crash

    Posted 15 Feb 2014

    Okay, using the files isn't necessary. It's convenient, but I'm okay with using a char array.

    However, the program doesn't agree. It still crashes!

    int optsvalid(int number, char **text)
    {
      int optnumber = number;
      int validoptnumber = 0;
      char *OPTLIST = "-gb -gbc -nes -snes -sms -gg -smd";
      while (optnumber != 0)
      {
        if (strcmp(text[optnumber], OPTLIST) != 1)
        {
          validoptnumber++;
          optnumber--;
        } else {
          optnumber--;
        }
      }
      if (validoptnumber != 1)
      {
        return FAILED;
      } else {
        return SUCCEEDED;
      }
    }
    
  5. In Topic: C - searching for string inside string results in crash

    Posted 15 Feb 2014

    View PostCTphpnwb, on 15 February 2014 - 10:45 AM, said:

    How are you calling the program? Do you have command line inputs?
    Do you output them at the beginning of main to see that they've been input correctly?

    You might try calling optsvalid using constants as a test.

    Constants? What do you mean?

My Information

Member Title:
New D.I.C Head
Age:
15 years old
Birthday:
August 28, 2000
Gender:
Location:
C:/
Programming Languages:
C, VB.NET, C#, Assembly

Contact Information

E-mail:
Private

Friends

Comments

~homsar47 has no profile comments yet. Why not say hello?