When I create a literal string and add it to the menu, everything works fine. But if I input a string from the user, then the menu is "blank". I don't know if this is a curses/menu problem, or a C problem, as I am a beginner at both.
#include <curses.h>
#include <menu.h>
#include <malloc.h>
int main()
{
MENU *my_menu;
ITEM **my...
Is there any way to check if a socket has disconnected on the remote end without select() in C?
The reason I don't want to use select() is that in the case that my buffers are full, there may be data available for reading on the socket that I am intentionally ignoring and a select(readfds=[socket_fd]) would always return immediately let...
I am curious about COM+, DCOM. I know that MSFT does not encourage you to use this tools natively (meaning with C/C++, in fact there is not a lot of documentation available) but I want to learn to use these technologies, like embedding Internet Explorer into a C program.
I thought that maybe I could find people that worked with this or ...
I'm porting some code to Windows, and the Microsoft compiler (Visual C++ 8) is telling me that strerror() is unsafe.
Putting aside the annoyance factor in all the safe string stuff from Microsoft, I can actually see that some of the deprecated functions are dangerous. But I can't understand what could be wrong with strerror(). It takes ...
I am a C++ programmer and recently joined a new company that uses a lot of C. When they reviewed my code, they were thinking I over-designed some of the things which I totally disagreed. The company is doing everything in embedded system, so my code needs to be memory
efficient, but the stuff I am doing is not CPU intensive. I would like...
In this previous question I posted most of my own shell code. My next step is to implement foreground and background process execution and properly wait for them to terminate so they don't stay as "zombies".
Before adding the possibility to run them in the background, all processes were running in the foreground. And for that, I simply ...
Hi all,
I've got a C program I'm writing. Here's what it does:
Create n fifos using mkfifo
Open them for read (with the O_NONBLOCK flag set)
Open them for write
Spawn a thread
In the thread, run in a loop:
Create an fd_set of the file descriptors for all n fifos
Call select(n, &my_set, NULL, NULL, NULL)
For each fd ready for I/O (...
In trying to get up to speed with C++ (coming from a long experience with C), I am obviously trying to do the right thing, and use as much as is standard as is possible.
However, in my readings on the matter I come accross a lot of criticism for standard things, and praise for non-standard things. For example, even the the (I assume) po...
First Question
From a C programmer's point of view, what are the differences between Intel Core processors and their AMD equivalents ?
Related Second Question
I think that there are some instructions that differentiate between the Intel Core from the other processors and vis-versa. How important are those instructions ? Are they being t...
Hey!
I have browsed every Google result, read all the forum posts about this error, but I cannot solve it.
When using PECL install for anything, I always end up getting this error:
checking whether the C compiler works... configure: error: cannot run C compiled programs.
Everything else succeeds up to that point them bam!
I'm using...
I'm trying to find a basic example, tutorial, or blog post on how to write a printer port monitor. I downloaded the Windows DDK and dug through localmon, but it appears that this sample is much more complex than just the nuts and bolts basics and from my understanding it is a bit different than an OEM port monitor because of how it hand...
Hi,
in my multithraded application, I'm using a sleep() function (the one from the GLFW library):
glfwSleep(..);
and it apparently leads my application to segfaulting as my call stack shows:
#0 76CFC2BC WaitForSingleObjectEx() (C:\Windows\system32\kernel32.dll:??)
#1 00000016 ??() (??:??)
#2 0000006C ??() (??:??)
#3 00000000 ??() (...
Possible Duplicates:
Valid use of goto for error management in C?
Examples of good gotos in C or C++
GOTO still considered harmful?
To Use GOTO or Not?
The goto statement seems very risky to use. When would it be a good scenario to use a goto statement instead of nesting control statements? Is it even a preferred way of ...
While writing some C code, I decided to compile it to assembly and read it--I just sort of, do this from time to time--sort of an exercise to keep me thinking about what the machine is doing every time I write a statement in C.
Anyways, I wrote these two lines in C
asm(";move old_string[i] to new_string[x]");
new_string[x] = old_string...
This concept seems to trouble me. Why does an NSError object need its pointer passed to a method that is modifying the object? For instance, wouldn't just passing a reference to the error do the same thing?
NSError *anError;
[myObjc doStuff:withAnotherObj error:error];
and then in doStuff:
- (void)doStuff:(id)withAnotherObjc error:(...
Can someone please shed some light on how popular languages like Python, Ruby implements hash tables internally for symbol lookup? Do they use the classic "array with linked-list" method, or use a balanced tree?
I need a simple (fewer LOC) and fast method for indexing the symbols in a DSL written in C. Was wondering what others have fou...
Hey all,
JNI on Ubuntu 8.10 using Eclipse and gcc (Standard with Ubuntu if there are flavours) i can't seem to load my library despite the make file creating it succesfully.
The main java class is as follows;
class Hello {
public native void sayHello();
static {
System.loadLibrary("hello.so");
}
public static...
It seems that there are several really fast prime factorization algorithms around (one that looks ideal is quadratic sieving). However, rather than make my own (likely poor) implementation I would like to use a ready-made library for simplicity.
I need to be able to factor integers of up to 15 digits efficiently. Because of that, I'm no...
I remember seeing somewhere that you could call python methods from inside C using
#include "python.h"
But I can't seem to find the source for this or any examples.
How can I call python methods from inside a C program?
...
In my simple custom shell I'm reading commands from the standard input and execute them with execvp(). Before this, I create a fork of the current process and I call the execvp() in that child process, right after that, I call exit(0).
Something like this:
pid = fork();
if(pid == -1) {
perror("fork");
exit(1);
}
if(pid == 0) ...