MosaicFuneral 812 Nearly a Posting Virtuoso

VX Heaven, that is all.

MosaicFuneral 812 Nearly a Posting Virtuoso

Dev-C++ and gcc are a bit different. At the core, though, they should be the same.

Dev-C++ is an IDE, not a compiler.

MosaicFuneral 812 Nearly a Posting Virtuoso

-> Did you ever read a book about operating system design ?

Who needs books on OS design? :P

MosaicFuneral 812 Nearly a Posting Virtuoso

How about no windows, and just a call that passes something to write(a box of pixels) to the video device? That's a lot of components of code to write just there.

By the way, Laik, how much of an OS do you have? You will probably want to lean more towards C than C++.

MosaicFuneral 812 Nearly a Posting Virtuoso

Lets take a look at a simple MASM32 program. Avoided invoke and macros for clarity.

.386
.model flat, stdcall

MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
ExitProcess PROTO :DWORD

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.data
  msg_title db "Title", 0
  msg_str   db "Text.", 0

.code
start:

  push 0
  push offset msg_title
  push offset msg_str
  push 0
  call MessageBoxA

  push 0
  call ExitProcess

end start

A brief C version.

#include <windows.h>

int main()
{
    MessageBox(0, "Text.", "Title", MB_OK);
    return(0);
}

Now, something you might see in a disassembler(@'s are xx's)

5469746C6500
  546578742E00

  6A00
  6800xxxxxx
  6806xxxxxx
  6A00
  E8xxxxxxxx
  6A00
  E8xxxxxxxx

  FF25xxxxxxxx
  FF25xxxxxxxx

That right there would be 427 ones and zeros, not including another KB of padding, headers, and tables. So unless you're one hardcore programmer, coding in machine code is beyond the scope of convention.

P.S. No one uses binary while dealing with op-codes.

MosaicFuneral 812 Nearly a Posting Virtuoso

1.

#include<stdio.h>
int main()
{
 int function(int);
  ...

Prototypes don't go inside other functions.

MosaicFuneral 812 Nearly a Posting Virtuoso

When did I ever say it should check grammar? Rather I said it should see if there was things such as: excessive capitals, no capitals, and other such things that might indicate a poor post. Checking grammar would be an exhaustive process.

MosaicFuneral 812 Nearly a Posting Virtuoso

To note, do not use exit(). In your main loop just break, and your destructors should clean anything.

MosaicFuneral 812 Nearly a Posting Virtuoso

You aren't serious! Are you ? :D

It's seems much more logical than what most of those, with offset thoughts, tossing their word-salads will suddenly say.

MosaicFuneral 812 Nearly a Posting Virtuoso

The "do something every Nth time through a loop" problem is probably where you'll see the modulus operator used most often.

I generally just use the logical AND operator for that.

MosaicFuneral 812 Nearly a Posting Virtuoso

Time to familiarize yourself with it: http://www.cplusplus.com/reference/stl/vector/erase/

MosaicFuneral 812 Nearly a Posting Virtuoso

'bout as well as it works for you.

Actually, I somehow think he's gone beyond bully and evolved into forum troll, back on his arrival at this site.

MosaicFuneral 812 Nearly a Posting Virtuoso

The linker doesn't need to know a thing about headers, that's all taken care of long before it gets to that point. A linker should just take your freshly compiled objects and put them together, in the proper system file format.

MosaicFuneral 812 Nearly a Posting Virtuoso

Search engines know all.

MosaicFuneral 812 Nearly a Posting Virtuoso

The one nieke_e posted and this tutorial http://www.codecolony.de/opengl.htm are my favorites, on OpenGL. I threw together a quick 2D engine, in about a day, after reading a few of those articles.

MosaicFuneral 812 Nearly a Posting Virtuoso

Build Your own RObot,
CRC's Handbook of Physics and Chem 63rd. ed. (always useful)
C# Pocket Reference

That's all I can think of, other than what I might have from the library at the moment.

MosaicFuneral 812 Nearly a Posting Virtuoso

dont mind me, im still figuring this site out.

768 post latter?!

MosaicFuneral 812 Nearly a Posting Virtuoso

But I believe the discussion about what instructions are generated by a compiler by the code you write is not at hand here.

True, just view my post as irrelevant or a minor side note of what might happen. What other time do I get to actually use this weird info, I've learned?

MosaicFuneral 812 Nearly a Posting Virtuoso

1) When I have

if (inventory.size() == MAX_ITEMS)
    {
    inventory.push_back("Rusty Armor");
    }
    else
    {
        deleteItem();
    }

uhmmm... If you have a full inventory of items, you get a free Rusty Armor, but if you don't you lose an item?
I think you meant to use inventory.size() != MAX_ITEMS What are all those if() and array swaps in deleteItem()? It's unreadable, learn how to use loops.

MosaicFuneral 812 Nearly a Posting Virtuoso

You could also check it by using the following code:

if(p == NULL)
{
    /* The memory wasn't allocated */
}

if(p == NULL) is if(!p)

MosaicFuneral 812 Nearly a Posting Virtuoso

Where you allocate your pointer, notice something wrong with new's "type"?

By the way, you should be checking if you allocation was successful or not!

int *p;

try{
  p = new int [5];
  if(!p) throw; }
catch(...) {
  emergency_handling(); }
MosaicFuneral 812 Nearly a Posting Virtuoso

type var_name = new type[n]; not type var_name = new var_name [n]; You need to establish a better naming system that allows you to recognize what is what, with just a glance.

MosaicFuneral 812 Nearly a Posting Virtuoso

Yes, i++ is just a shorthand for i = i + 1.

Well.... if I remember right, var++ and var-- on x86 style machines will generate INC and DEC instead of SUB and ADD. Which do not affect the carry flag and by not having a following value taking space: it keeps both written code and the generated executable leaner.

MosaicFuneral 812 Nearly a Posting Virtuoso

That might work as long as exe b is not running while exe a is writing to the file. Running executables can be opened for reading, but not for writing.

Quick fix, just have A wait till B isn't running, since most likely B would quit after it opens and passes data to A.

MosaicFuneral 812 Nearly a Posting Virtuoso

Show us the code, with CODE TAGS.

MosaicFuneral 812 Nearly a Posting Virtuoso

Yeah I'm aware of that, Im talking about for example

2 executables

exe a and exe b
exe a will configure/edit values of exe b
exe b will retain them and use them will running self contained

Best tut on the Windows 32 PE("exe") format
http://webster.cs.ucr.edu/Page_TechDocs/pe.txt

Exe A gets B's DOS header, with the PE offset it gets the IMAGE_NT_HEADERS, right afterwards is the section headers find your section, jump to that section and.... the rest is up to you.

MosaicFuneral 812 Nearly a Posting Virtuoso

True, but im looking for a PoC in a weird way, I need to do it in that specific way, no alternatives

Okay, but what OS are you on?
You could append the data to the end of the file, spread it through out unused header crap, or:
create your own section and declare a variable(preferably a string) inside of there, look up the section and overwrite the values with the new values.

MosaicFuneral 812 Nearly a Posting Virtuoso

Well why not just save it in a encrypted file? Keeps everything separate from getting lost.

MosaicFuneral 812 Nearly a Posting Virtuoso

The Art of C++ was a great book; regardless, perhaps you should turn it into a crude compiler that puts it into MASM32 mnemonic, or some other flow of choice.

MosaicFuneral 812 Nearly a Posting Virtuoso

Lets just simplify this to three methods:

One, create a resource file which the program will load. This is easily modifiable by external programs.

Two, use pipes and send something telling the program to use the following alternative data.

Three, open the executable, find the initialized data and overwrite it.

The first one is easy, but has to be done before execution; Second one may complicate things, if you do not think it through and design it as simple as possible; Third one is very involved and can drive you insane with things as simple as off-by-one errors.

MosaicFuneral 812 Nearly a Posting Virtuoso

Does your project require boost? I'd just avoid it altogether.

MosaicFuneral 812 Nearly a Posting Virtuoso

Then analyze if it is a formal title or group of numbers, before you split it off.

MosaicFuneral 812 Nearly a Posting Virtuoso

Huh? How does that link relate to this discussion?

It's a site about the evils of Wal-Mart.

MosaicFuneral 812 Nearly a Posting Virtuoso

You can get a Dell computer for under $500.00 USD at Wal-Mart. Or go online at www.walmart.com to see other models. Sorry is this post seems spammy, but I'm just answering the original post.

Or maybe not.

MosaicFuneral 812 Nearly a Posting Virtuoso

Oh, of course checking if there is more than 45% capital letters, which is probably a sign of using all caps or something like "tHiS".

MosaicFuneral 812 Nearly a Posting Virtuoso

In tech forms, when someone starts a new thread. It should be evaluated whether it has at least rudimentary sentence qualifiers, in the non-code tag fileds.
A crude list of requirements might be: at least on capital and lowercase letter, one of .,?!;, perhaps even no excessive usage of internet common acronyms(possibly to slow?).

Why should such a scanner be implemented:

  • "i don lik seein stuf lik thi in a threa"
  • May prevent some unreadable inquiries, being posted in the forums.
  • People attempting to post such poorly formatted post, might rethink their message and give it an overhaul.

Obviously, I am, as stated, talking about checking for the bare essential characteristics of a readable sentence. Otherwise anything more grammatically correct than that, would prevent a lot of people(including myself) from ever being able to post! lol
Although there could always be an "ignore it" option.

MosaicFuneral 812 Nearly a Posting Virtuoso

Eh? Impossible to read what? The site to which I linked to?

It was all purple, earlier:
http://www.daniweb.com/forums/thread184413.html

Where's the hentai previews?

MosaicFuneral 812 Nearly a Posting Virtuoso

I don't like have snippets seem random now... I want to know anything new is now available for any language.

MosaicFuneral 812 Nearly a Posting Virtuoso

Wow! That's the lamest "encryption" I've ever seen, hardly even a cipher.

MosaicFuneral 812 Nearly a Posting Virtuoso

Why not just allocate a single array and treat it as a x*y space. for every y spaces is a new x row Less initializing time spent doing separate allocations, for every new row. Particularly if this code is only for small 2D arrays; for larger amounts of data and more involved code, you'll need to write a container or look into the ones C++ provides(ie. vector, map, stack, string(for all char types), et al.).

MosaicFuneral 812 Nearly a Posting Virtuoso

So like in games when you have the option of which device to use; the custom "plug-ins/updates" would contain the rules on how to interact with the unknown hardware?

MosaicFuneral 812 Nearly a Posting Virtuoso

VC++ does seem likely, but who cares?

MosaicFuneral 812 Nearly a Posting Virtuoso

http://www.kernel.org/
Dowload a source, and perhaps look around in:

  • linux-2.x.x\include\serial.h
  • linux-2.x.x\include\serial_core.h
  • linux-2.x.x\drivers\serial\serial_core.c
MosaicFuneral 812 Nearly a Posting Virtuoso

If the file is NULL, then why are you still using it afterwords? Perhaps you should have one function to load, and one to save.

You aren't closing the file pointer after you're finished.

MosaicFuneral 812 Nearly a Posting Virtuoso

If you're writing drivers and crap for a CNC or something, then you could cost a business millions.

Two ways that might cause damage to a PC style computer: wrong BIOS call to a device erasing data, or throwing an old CPU(with design flaw, and inadequate cooling device) into somesort of lock till it overheated.

MosaicFuneral 812 Nearly a Posting Virtuoso

Oh, I doubt Dani wants to open the gates to hordes of pubescent leet gankers, pwning this and roflcoperting that and generally epeeing about the place.

I think we're starting to see them creep their way in now.

Wow! I can so easily guess your age from that reply of yours :icon_rolleyes:

Eight-through-twelve?

MosaicFuneral 812 Nearly a Posting Virtuoso

Why do you need Boost?

MosaicFuneral 812 Nearly a Posting Virtuoso

Why exactly are you allowed to do that?

MosaicFuneral 812 Nearly a Posting Virtuoso

Your outrage says I should give you a ticket. :P

MosaicFuneral 812 Nearly a Posting Virtuoso

As Danny said, declare seed in main().
Second, to have the function modify a variable you need something like void foo(int &bar); note the "&".