I direct you to Kernighan & Ritchie exercise 7.1
Write a program that converts upper case to lower case or lower case to upper case depending on the name it is invoked with,...
How can I invoke the same program with different names?
I am using Linux, so I am invoking a compiled program just by entering:
$./a.out
What should ...
I am fairly new to developing C/C++ code in MSVS but one of the things that has already confused me is why, after adding a set of source and header files to my project such that they show up respectively under the MSVS folders 'Source Files' and 'Header Files', do I subsequently have to tell the compiler where my header files are under '...
Hi,
I was writing a command line program which will have a status bar, much like wget.
The main problem I'm facing is: how do I delete what I've already sent into stdout/stderr?
I had on idea: use the backspace char '\b' and erase the output I've sent. Is that the best way? Is it the only way? Is there a better way?
PS: I don't want ...
If I have the following:
typedef struct _MY_STRUCT
{
int a;
float b;
} MY_STRUCT, *PMYSTRUCT
What does *PMYSTRUCT do? Is it now a pointer type which I need to declare or just a pointer to _MY_STRUCT which I can use?
I know that MY_STRUCT is a new type that needs to be used as follows:
MY_STRUCT str;
str.a = 2;
But what abou...
Hi.
I have the compiler complaining (warning) about the folowing.
Am I missing something? Because I thought this didn't need a cast
char* CurrentCh = some ptr value;
int size;
size = func(&CurrentCh);
with func defined like this
int func(void** ptr);
Compiler warning:
passing argument 1 of 'func'
from incompatible pointer ...
I'm writing a program that deciphers sentences, syllables, and words given in a basic text file.
The program cycles through the file character by character.
It first looks if it is some kind of end-of-sentence marker, like ! ? : ; or .
Then if the character is not a space or tab, it assumes it is a character.
Finally, it identifies tha...
I am trying to integrate some external code into my application. My code was pure C, but the new code is C++, so I simply renamed my C files to .cc and compiled the whole thing with g++.
It compiles fine, but I get a crapton of link errors :
CMakeFiles/svrt.dir/svrtH_generator.cc.o: In function `operator new(unsigned long, void*)':
svr...
Text is disappearing from the bottom of a RichEdit control window and I'd like to ensure the bottom character is always visible. Obviously, I could manually scroll to the bottom, but I'd like to do it under software control.
...
I'm working on a project that is written in both C++ and python. I have the following line in my configure.ac:
AC_INIT(MILHOUSE, 0.3.6)
which means that in the config.h generated by running configure, i have the following define line:
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.6"
I just wanted to kn...
I'm working on trying to speed up some general data processing in C. I've written several subroutines of the form:
double *do_something(double *arr_in, ...) {
double *arr_out;
arr_out = malloc(...)
for (...) {
do the something on arr_in and put into arr_out
}
return arr_out;
}
I like this style because it's eas...
I've not had the Kernighan and Ritchie C reference in years, but I remember that there was a page in there that talked about how to enter characters that were unavailable to you. (WAY back in the day, some keyboards lacked characters like ", ~, etc.)
To be clear, let me give an example. I'm not looking for a way to get quotes in strin...
I have been trying out some basic exercises involving loops.
Can someone tell me why the following snippets have different outputs?
While Loop
while (i<3)
{
while(j<3)
{
printf("(%d %d) ",i,j);
j++;
}
i++;
}
Output
(0 0) (0 1) (0 2)
For Loop
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
...
Hi all,
I have a log file which has a format of this kind:
DATE-TIME ### attribute1 ### attribute2 ###attribute3
I have to search this log file for a input attribute(entered from command line) and output the lines that match the entered attribute.
A naive approach may be something like this:
scan the entire file line by line
searc...
I've been programming in .NET C# almost exclusively for the past 7 months or so. Before that, most of my programming had been in C++ (from school). At work, I will likely be needing to do a whole bunch of C in the next few months. Most of my exposure to C comes from micro-controllers and stuff I find on the internet. I understand the syn...
I am trying to create a GUI to display information read from a file. So I will need some number of pushbuttons, text fields, and radio buttons - but I won't know how many I need until run-time.
I am using Visual Studio 6.0. My toolset is fairly non-negotiable, so please refrain from suggesting Java, or any C++ toolkit that does not co...
This is a weird question, but is there a standard way to manipulate the contents of a va_list before passing it to another function? For instance, suppose I have two functions, sum and vsum:
int vsum(int n, va_list ap) {
int total = 0;
for (int i = 0; i < n; ++i) {
total += va_arg(n, int);
return total;
}
int sum(in...
I would like to know how to programmatically hide a file but making the file or folder still hidden with Show hidden files and folders enabled from the Tools->Folder options of Explorer.
I hope I am not confusing anyone and if I might be please just ask.
...
Hi I'm working in a Linux environment and I have to link to a object file already compiled which offers me some services (services.o) and I know some of them, but I'd like to know which are all of the exported symbols of it.
Is there any way to accomplish this not having the sources? If so, how?
Thanks you very much.
...
I have a RichEdit control in my simple application that I wish to simulate a console-like display with. I want to be able to have a buffer of x number of lines (say, 300) and whenever a line is added, I would like to also remove the oldest (top) line if the new line exceeded the threshold x. I would also like it to automatically scroll...
Hello, I'm struggling to use calloc and realloc for my array initializations. I'm trying to write a program which calculates a final sum from the command line arguments using fork() with a companion program.
If I receive a odd set of integers from the command line such as: ./program 1 2 3 4 5.
It should see that amount is odd and ini...