TheBeast32 54 Posting Whiz in Training

Hi, how would I make a simple kernel in C that I could boot on my PC?

TheBeast32 54 Posting Whiz in Training

This...

What do you mean?

TheBeast32 54 Posting Whiz in Training

I switched from Dev-C++ to Code::Blocks. No difference in compiler (I use MinGW), but I like the GUI a lot more than Dev's.

TheBeast32 54 Posting Whiz in Training

I found this http://www.codeproject.com/KB/IP/sniffer.aspx. This is what I wanted to do.

Comatose commented: Fantastic Find +9
TheBeast32 54 Posting Whiz in Training

1. The port doesn't have to be 1337, it was just an example

2. Thanks pipaman, I'll try that

TheBeast32 54 Posting Whiz in Training

Hi, I was wondering how you would intercept data on a given port without interrupting it in WINSOCK. Like if computer A sent computer B "hi" on port 1337 and it was received on a server program. How could I listen for that data on computer B, but still let the data get to the server program. If you have no Idea what I'm asking just tell me and I'll try to explain it better.

TheBeast32 54 Posting Whiz in Training

Thanks.

TheBeast32 54 Posting Whiz in Training

Hi, I'm thinking of getting a new CPU. Here it is on NewEgg: http://www.newegg.com/Product/Product.aspx?Item=N82E16819116027. My motherboard is here:http://www.dealtime.com/xPF-SIS661FX-PGA478-M-ATX-PRESCOTT. My question is: will my motherboard support this CPU? Thanks in advance.

TheBeast32 54 Posting Whiz in Training

Ok

TheBeast32 54 Posting Whiz in Training

You can also do:

#include <iostream>
#include <conio.h>

int main()
{
   std::cout << "HELLO WORLD!!!!!!!111";
   getch();
}
TheBeast32 54 Posting Whiz in Training

Can I make the cache bigger?

TheBeast32 54 Posting Whiz in Training

Hi, I recently got 2 GB of DDR-SDRAM and an NVIDIA GeForce AGP graphics card. My processor is 2.5 Ghz (Uniprocessor), but I think it runs slow. At my school, there are uniprocessor pcs which run faster. They have less RAM and slower CPUs too. I don't know why this is happening, but how could I optimize my processor without overclocking it.

My computer specs (not updated on my profile, I'm going to later):
MS Windows XP SP2
Intel Celeron 2.5 Ghz CPU
2.0 GB DDR-SDRAM
NVIDIA GeForce 6200

I have attached a list of my processes from windows powershell. It looks like crap in notepad, so open it in ConText or something. My computer has recently been cleaned out (dust and stuff), so I know that's not the problem.

TheBeast32 54 Posting Whiz in Training

Do you need help with anything? If you're just posting this and don't need help, you could put it into the code snippets section.

TheBeast32 54 Posting Whiz in Training

Thanks

TheBeast32 54 Posting Whiz in Training

I'm thinking about building a new computer. How much do you think it would cost for a REALLY fast processor, motherboard, power supply, hard disk, RAM, and everything else to build a computer from scratch?

TheBeast32 54 Posting Whiz in Training

Would turning the quality down increase performance? Also, 30 FPS would be good enough for me. I sometimes get it down to only 5 FPS.

TheBeast32 54 Posting Whiz in Training

Hi, I just bought 2 GB of DDR-SDRAM and an e-GeForce 6200 graphics card (AGP) by NVIDIA. I bought a game (The Orange Box), installed Half-Life 2, and ran it. The graphics displayed perfectly and there was no lag there, but when the game started handling AI, gunfire, etc., it LAGGED A LOT! So I'm thinking of buying a new processor. I have no idea which CPUs will work on my motherboard. If you have any ideas, please help.

My motherboard is: MSI 661FM2-LSR (MS-7060)

TheBeast32 54 Posting Whiz in Training

<winsock.h> :P

TheBeast32 54 Posting Whiz in Training

It compiles fine with Code::Blocks and MinGW. You have to link with libwinmm.a if you have MinGW or winmm.lib for anything else.

TheBeast32 54 Posting Whiz in Training

I have no problem with WINSOCK, I just wanted to know if there are any other ways to use sockets on Windows. I could probably get cygwin, too.

TheBeast32 54 Posting Whiz in Training

After messing with the program for a while, I found that recv will return 0 if it's done. Is this correct?

TheBeast32 54 Posting Whiz in Training

Hi, I'm using WinSock, and am making a function to receive data. How can I know when I have reached the end of the data that I'm receiving. Like, if I send "GET /" to www.google.com on port 80, I should receive the HTML of the index page. But in my loop that receives, it won't stop until it gets x number of bytes. This results in an infinite loop. How can I tell if a server stops sending me data so I can stop the loop?

bool RecvAll(SOCKET sock, char *data, long size)
{
   long BytesRecv = 0;
   long BytesRecvTemp = 0;

   if (sock == INVALID_SOCKET) return false;

   while (BytesRecv < size)
   {
      BytesRecvTemp = recv(sock, data, size - BytesRecv, NULL);
      if (BytesRecvTemp > 0)
      {
         BytesRecv += BytesRecvTemp;
         data += BytesRecvTemp;
      }
      else if (BytesRecvTemp < 0)
      {
         memset(data, 0, size);
         return false;
      }
   }

   return true;
}
TheBeast32 54 Posting Whiz in Training

So I am doomed to WINSOCK?

TheBeast32 54 Posting Whiz in Training

I installed Code::Blocks, and I set my compiler as MinGW which is installed on my computer, but there still is not a <sys/socket.h> include, which compiler should I install. I'm on Windows XP Pro SP2 32 Bit.

TheBeast32 54 Posting Whiz in Training

Hi, is there a socket library besides WINSOCK that I can use with Dev-C++. I don't have a <sys\socket.h> include. Is there a devpak that I can get, or am I doomed to WINSOCK?

TheBeast32 54 Posting Whiz in Training

I did a registry fix on HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management, and that lowered my PF usage, and Windows seems more lenient to use more RAM. I'm going to get 2 GB of RAM later this month as I said, but my motherboard only supports DDR RAM, should I get a new mothermoard that supports DDR2, or is just regular DDR just as good?

TheBeast32 54 Posting Whiz in Training

I used the memory restoring thing. It freed some, and Windows used it, but I still stay above 100 Mb free of RAM. Can I get Windows to use swap file only if it's extremely low on RAM?

TheBeast32 54 Posting Whiz in Training

Why won't Windows just use at least 3/4 of the RAM without going into the swap file? I'm on another computer and it has about 1 Gb of RAM free, but I'm using 263 Mb of the swap file.

TheBeast32 54 Posting Whiz in Training

Hi, I have 490 MB of RAM, but in the task manager, while running firefox and some other stuff, it says i have 160 MB free physical memory, but it also says I'm using almost 500 MB of my swap file! How can I get Windows to utilize that extra RAM? :P

Here's what the task manager says:

Total physical memory: 490992 Kb
PF Usage: 492 MB

If I need more RAM, I'm getting some later this month anyway, but right now I only have 490 MB.

TheBeast32 54 Posting Whiz in Training

On this line:

int holdu, holdc, p, i,;

take out the comma after the i:

int holdu, holdc, p, i;
TheBeast32 54 Posting Whiz in Training

To export code as HTML, do File->Export->To HTML. If I interpreted your second question right, to write output from your program to an HTML file, just do some file I/O.

TheBeast32 54 Posting Whiz in Training

I was just curious, I absolutely do not want to make any type of virus, trojan, or malware.

TheBeast32 54 Posting Whiz in Training

So there's absolutely no way possible for the average person to write to it?

TheBeast32 54 Posting Whiz in Training

Hi, I was told that you can crash Windows in C++ or C by "corrupting the kernel", and I wanted to know if this was actually possible. If anyone knows if this is possible, or how it happens, please tell me. ;)

TheBeast32 54 Posting Whiz in Training

Hi, I have put DSL (Damn Small Linux) onto my 256 MB pen drive to try and boot my computer with it. I can, but it says it can't find the KNOPPIX file system. I can boot it from Windows with QEMU, and it works fine. I have tried this on two computers, so I know it's not them. My pendrive is formatted in FAT (I have already tried FAT32 with no luck), it's a 256MB SanDisk Cruzer Freedom, if that helps any.

TheBeast32 54 Posting Whiz in Training

Hello is spelled without the w. =)
Also, trigonometry is the way to go. You can probably find a tutorial or something: www.google.com/search?q=Trigonometry+Tutorial

TheBeast32 54 Posting Whiz in Training

In Beginning Game Programming by Michael Morrison, it tells how to get joystick input. Get it from the library or something.

TheBeast32 54 Posting Whiz in Training

Hi, I was reading something that said goto was bad. Why is it a bad practice to use it?

TheBeast32 54 Posting Whiz in Training

The Dev-Pak for GMP is on this thread. I attached it to one of my posts: http://www.daniweb.com/forums/thread145324.html

TheBeast32 54 Posting Whiz in Training

Weird, I just used Windows' BITMAPFILEHEADER and BITMAPINFOHEADER structures and it worked fine. Thx anyway.

TheBeast32 54 Posting Whiz in Training

Hi, I'm reading a bitmap manually to try and make a program that does steganography, but I can't read the file correctly. The headers I read come out completely messed up, and they fail the check to see if I'm reading a bitmap file or not (if (FileHeader.bfType != (int)"BM")). Please help.

#include <iostream>
#include <stdio.h>
using namespace std;


class BMP
{
   public:
          
	  typedef struct 
	  {
	  WORD bfType;
	  DWORD bfSize;
	  DWORD bfReserved;
	  DWORD bfOffBits;
	  } BMP_FILE_HEADER;

	  typedef struct 
	  {
	  DWORD biSize;
	  LONG biWidth;
	  LONG biHeight;
	  WORD biPlanes;
	  WORD biBitCount;
	  DWORD biCompression;
	  DWORD biSizeImage;
	  LONG biXPelsPerMeter;
	  LONG biYPelsPerMeter;
	  DWORD biClrUsed;
	  DWORD biClrImportant;
	  } BMP_INFO_HEADER;
	  
 	  BMP_FILE_HEADER FileHeader;
	  BMP_INFO_HEADER InfoHeader;
	  unsigned char *Data;
	  
	  // Methods
      bool LoadBitmapFile(const char *Filename);
};

bool BMP::LoadBitmapFile(const char *Filename)
{
   BMP Bitmap;
   unsigned char *bitmap_Image;
 
   FILE *File = NULL;
   unsigned int ImageIdx = 0;

   File = fopen(Filename,"rb");
   
   if (!File)
      return false;
   
   // Read the file header
   fread(&Bitmap.FileHeader, sizeof(BMP_FILE_HEADER), 1, File);
   
   // Check if its a bitmap or not
   if (FileHeader.bfType != (int)"BM")
      return false;
   
   // Read the info header
   fread(&Bitmap.InfoHeader, sizeof(BMP_INFO_HEADER), 1, File);
   
   // Store the data
   memcpy((char*)&this->FileHeader, (char*)&Bitmap.FileHeader, sizeof(BMP_FILE_HEADER));
   memcpy((char*)&this->InfoHeader, (char*)&Bitmap.InfoHeader, sizeof(BMP_INFO_HEADER));

   // Move to the bitmap data
   fseek(File, Bitmap.FileHeader.bfOffBits, SEEK_SET);
   
   // Allocate memory
   if (Bitmap.InfoHeader.biSizeImage != 0)
      bitmap_Image = (unsigned char*)calloc(Bitmap.InfoHeader.biSizeImage, sizeof(unsigned char));
   
   if (!bitmap_Image)
   {
   free(bitmap_Image);
   fclose(File);
   return false;
   }
   
   // Get RGB instead of BGR
   for (ImageIdx=0; ImageIdx < Bitmap.InfoHeader.biSizeImage; ImageIdx+=3)
   {
      bitmap_Image[ImageIdx] = bitmap_Image[+2];
      bitmap_Image[ImageIdx+2] = bitmap_Image[ImageIdx];
   }
   
   // Store the bitmap data
   memcpy((unsigned char*)&this->Data, (unsigned char*)&bitmap_Image, Bitmap.InfoHeader.biSizeImage);
   
   // Clean up and …
TheBeast32 54 Posting Whiz in Training

I have tried to do this before. Just read a tutorial on how to do it by hand and make a function or whatever.

Check this out: http://www.permadi.com/tutorial/numBinToDec/index.html

Pretty much, you move left starting from the first binary digit on the right. You increment the power from 0, and multiply the digit by 2^power. So:

1010

0*(2^0) = 0
1*(2^1) = 2
0*(2^2) = 0
1*(2^3) = 8

0 + 2 + 0 + 8 = 10

1010 = 10

I'm pretty sure that you can do this conversion for any number base system. Like for base 3: instead of Digit*(2^Power), you would do Digit*(3^Power).

minigweek commented: Correct! +2
TheBeast32 54 Posting Whiz in Training

Thanks! That works perfectly! :)

TheBeast32 54 Posting Whiz in Training

In Dev-C++ 4.9.9.2:
`bool' undeclared (first use in this function)

(Each undeclared identifier is reported only once for each function it appears in.)

TheBeast32 54 Posting Whiz in Training

Hi, I keep getting an undefined identifier error when I try to do this:

typedef char bool; // Make a bool type
char false = 0, true = 1; // Make true and false

void foo()
{
switch (something)
{
case 1:
bool aaaaa;
break;
}
}

It only gives me an error it if i try to declare it in a case. Please help :P

TheBeast32 54 Posting Whiz in Training

o thanks!

TheBeast32 54 Posting Whiz in Training

Hi, I'm taking a programming class at my school. My teacher gave us a pdf that said "..You will be writing a program that can read a bitmap and insert a secret message into the bytes of the picture in a retrievable way using the picture as a cipher and return the original message. This is a type of encryption that is very easy to accomplish and very difficult to decipher or uncover. It both ends of the communication have the same original picture, then deciphering is asimple matter of filtering out the original, and all you have left is the message."
He hasn't assigned it yet, but I just want to know if that is possible while keeping the original picture with the secret message in the bitmap or whatever we're using. Like having the message "stuffffff" in the picture, but have the picture look the same as the original.

TheBeast32 54 Posting Whiz in Training

Nice chococrack =)

TheBeast32 54 Posting Whiz in Training

You need to add the bin directory of MinGW to your PATH environment variable.

TheBeast32 54 Posting Whiz in Training

Hi, I'm need to be able to load bitmaps, preferably as resources, draw them, and get their size. How would I do this? I'm on Windows, and using Dev-C++ 4.9.9.2.