I didn't realize this place was full of a bunch of unix snobs.
Goodbye.
Type: Posts; User: nucleon
I didn't realize this place was full of a bunch of unix snobs.
Goodbye.
-- i thought there is no true/false in C only 0 and not 0
Including <stdbool.h> as master5001 suggests adds "bool", "true", and "false",
although it is simple to define it yourself as matsp points...
You'll also need to eat the newline after reading the first five characters. So after your first for-loop you'll need an extra getchar(). Actually, there are better ways to read strings, but maybe...
A few problems:
* You entered the terminating 0 into the queue.
* You've ignored the rear pointer.
* You've created a stack, not a queue (i.e., following the "front" pointer prints out the input...
Since no one else is touching this, here's a rewrite. Study the changes carefully, especially those involving pointers.
#include <stdio.h>
#include <malloc.h>
struct node
{
int info;
...
Can you upload it in a different format? A gif or jpg perhaps?
So your question is why does *pname output a single char while pname outputs the entire string? pname is a pointer to char, so *pname is a char, thus you get a char. Being a pointer to char, pname is...
Yes you can alter it.
Usually, you also pass the size of the array to a function:
void show( int n[], int size)
{
while (size--) printf( "%d ", *n++);
printf( "\n");
}
You can simplify that, but you still need a bunch of defines.
#include <conio.h>
// Name some control-codes
#define KEY_BEL 7
#define KEY_BS 8
#define KEY_TAB 9...
You don't need to convert to binary since everything in a computer is already in binary. To "XOR two strings" may mean this:
char s1[] = "abcdefg";
char s2[] = "hijklmn";
int i;
for (i = 0;...
str2 needs to have at least 2 characters in order to contain the terminating null char. So str2[2].
Or you could make str2 a char instead of an array and use strchr instead of strstr.
Post the code, preferably the least code that duplicates the problem.
The return value is a thread id. Try this for the process id.
DWORD pid;
DWORD tid = GetWindowThreadProcessId( hwnd, &pid);
/K keeps the console open while /C closes it afterwards.
Looks like you're compiling a cpp file as a c file.
Try changing the filename to whatever.cpp.
Make sure you're compiling a cpp project.
This works for me:
int main()
{
STARTUPINFO si = {sizeof(STARTUPINFO)};
PROCESS_INFORMATION pi;
CreateProcess( "C:\\Windows\\System32\\cmd.exe",
" /K echo...
Here's a strtok replacement I wrote that returns non-space delimiters as tokens also. Spaces are automatically considered delimiters but are not returned.
#include <iostream>
#include <cstring>...
EnumWindows takes a function pointer to a callback function which is passed the window handles one at a time (and an application-defined LPARAM):
BOOL CALLBACK
enumWindowsProc( HWND hwnd,...
To send commands to cmd from the command line, you must use either the "/C" or "/K" switches. Look at "help cmd". So your call to runScripts would be e.g.:
runScripts( " /K echo howdy");
You...
fgets() reads from the file into a null-terminated string. The EOF is not stored. EOF is not even actually a character. It is an int so that its bit-pattern can be distinguished from all chars. The...
I've written only one small client/server program before and I'm not sure how peer-to-peer is different. I guess I'm lost in the nomenclature itself. For instance, where do sockets fit into this?...
You are missing a few braces. And notice how more careful indenting makes it easier to read.
#include< stdio.h>
int main()
{
int num;
int oddcount, evencount;
Look up AllocConsole() on MSDN.
If I wanted to make a card game between two people to be played over the internet, which is better, client/server or peer-to-peer? Are there other alternatives?
Yes, the numeric code for escape is 27. Function and arrow keys give two numeric codes in a row, taking two iterations of the loop.
There may be a higher-level way of detecting them. Windows has...