Search found 97 matches

by ajtgarber
Sat Mar 03, 2012 12:52 pm
Forum: Programming Discussion
Topic: *nix open call in C
Replies: 2
Views: 1485

*nix open call in C

/* File: lifeping.c Description: This application tells a set server (192.168.1.20) at certain intervals that it is indeed still alive. Interval: About 5 minutes Port: 2024 Protocol: <connect>, send identification code, send status, <terminate> */ #include <stdlib.h> #include <stdio.h> #include <un...
by ajtgarber
Thu Jan 12, 2012 10:21 am
Forum: Programming Discussion
Topic: x86 Assembly Command Line Arguments
Replies: 1
Views: 1013

x86 Assembly Command Line Arguments

Hello, I've written a few assembly programs recently trying to print out all of the command line arguments given to the program but I've come across a few issues. First way I tried (just to get the first argument) was to pop off the char* and try to print it with the system call write: section .text...
by ajtgarber
Thu Dec 08, 2011 2:35 pm
Forum: Programming Discussion
Topic: Unix utilities (rewriting cp)
Replies: 1
Views: 743

Re: Unix utilities (rewriting cp)

I found how to do it, posting so people can possibly find this in the future: Using the stat call I got a stat structure about the input file, then I passed the st_mode value from the structure into the chmod cal. Code: struct stat st; int statVal = fstat(sourcefd, &st); if(statVal == -1) { prin...
by ajtgarber
Thu Dec 08, 2011 1:06 pm
Forum: Programming Discussion
Topic: Unix utilities (rewriting cp)
Replies: 1
Views: 743

Unix utilities (rewriting cp)

I've decided to start rewriting Unix utilities using Unix library calls in C so that I can become more familiar with the library calls and C, and I've run into a bit of a snag. I've rewritten cp so that it actually copies the file, but when I try to use cat to see the contents of the file it always ...
by ajtgarber
Wed Nov 30, 2011 1:46 pm
Forum: Programming Discussion
Topic: Maintaining a consistent frame rate with HTML5
Replies: 3
Views: 1341

Re: Maintaining a consistent frame rate with HTML5

Thanks, it doesn't seem to have fixed it though. For some reason it moves the square smoothly for about a few seconds then makes a large jump, moves smoothly then jumps again, and so on (as before).
by ajtgarber
Tue Nov 29, 2011 1:42 pm
Forum: Programming Discussion
Topic: Maintaining a consistent frame rate with HTML5
Replies: 3
Views: 1341

Maintaining a consistent frame rate with HTML5

I've been having trouble trying to maintain a consistent frame rate with HTML5 (I'm using Firefox right now, when I get back home I'll be using Chrome). In order to get my frame updates I've been using javascript's setInterval function, and to combat the inconsistencies of the times my function is c...
by ajtgarber
Thu Nov 17, 2011 3:00 pm
Forum: Programming Discussion
Topic: PHP Writing to a file
Replies: 11
Views: 2895

Re: PHP Writing to a file

I have gotten it to work with the chmod 777, but I'm wondering how I would solve this long-term so I wouldn't have to continually do this to files that would need to be edited by my PHP scripts. I think apache is running as root because I took an upload script of the net and tested it with a simple ...
by ajtgarber
Mon Nov 14, 2011 12:32 pm
Forum: Programming Discussion
Topic: PHP Writing to a file
Replies: 11
Views: 2895

Re: PHP Writing to a file

Chmodding the chat.txt? If so, its still telling me that it can't open the file (for writing)
by ajtgarber
Sun Nov 13, 2011 8:01 pm
Forum: Programming Discussion
Topic: PHP Writing to a file
Replies: 11
Views: 2895

Re: PHP Writing to a file

Yeah, I looked in the apache log and it turned out to be a permissions issue, now I'm wondering how I solve it. In my configuration file I have the server admin set as my user @localhost, and the owners of the files should also be owned by my user. Tell me if you want me to post the config file
by ajtgarber
Fri Nov 11, 2011 10:45 am
Forum: Programming Discussion
Topic: PHP Writing to a file
Replies: 11
Views: 2895

PHP Writing to a file

I'm creating a test site so that you enter a name and a message, and once you submit the form it appends what you added to a file, the main page reads from the file and writes it to the page. For some reason the reading works fine, but the script that is supposed to write to the file won't open it (...
by ajtgarber
Sat Aug 13, 2011 2:42 pm
Forum: Programming Discussion
Topic: Segmentation fault with function pointers
Replies: 5
Views: 1224

Re: Segmentation fault with function pointers

I renamed the functions in my test program and it ran well, I renamed them back to what they were before and made the function pointers static and it also worked.
Thanks! It always seems to be something really small that trips me up :oops:
by ajtgarber
Fri Aug 12, 2011 9:35 am
Forum: Programming Discussion
Topic: Segmentation fault with function pointers
Replies: 5
Views: 1224

Segmentation fault with function pointers

I've just started playing with creating shared libraries (and libraries in general) and I've come across an issue. In my library I have a function called setInitFunc which takes a function pointer to a function that returns nothing and takes nothing. void (*initFunc)(void), when I build my test appl...
by ajtgarber
Fri Jun 10, 2011 8:25 am
Forum: Programming Discussion
Topic: Dynamic Memory Allocation (maps)
Replies: 7
Views: 1354

Re: Dynamic Memory Allocation (maps)

My malloc calls are returning pointers (my last run gave me: 0xba2940, 0xbfa310. Not that thats helpful or anything). My Tile class currently does not have a copy constructor, if I'm using memcpy would I need it? Is there any way to check if my program has access to a pointer? EDIT: Oops! I don't kn...
by ajtgarber
Thu Jun 09, 2011 6:31 am
Forum: Programming Discussion
Topic: Dynamic Memory Allocation (maps)
Replies: 7
Views: 1354

Re: Dynamic Memory Allocation (maps)

I've changed the sizeof(Tile**)'s to sizeof(Tile*) and the sizeof(Tile*) (from before) to sizeof(Tile). Its still crashing at the same point, this time instead of the whole mess of messages, its giving me the "Segmentation Fault". I wanted to have the dynamic memory in the map so that if s...
by ajtgarber
Wed Jun 08, 2011 3:23 pm
Forum: Programming Discussion
Topic: Dynamic Memory Allocation (maps)
Replies: 7
Views: 1354

Dynamic Memory Allocation (maps)

http://pastebin.com/XQEpni3d DynamicTileArray.h http://pastebin.com/0Z1zTnN0 DynamicTileArray.cpp (allocation & deallocation are being done with malloc() and free()) Okay, recently I've been trying to make a map class that allows you to make a dynamically sized map (rather than locking you into...