| |
thread by: disco |
last post Nov 13 '05 by: disco
I am working on this example from a book "C Primer Plus" by Prata 4th
edition - p. 672. There is no erata on this problem at the publisher's
website.
1) Is it a violation of copyright laws to post example code from a
book to a newsgroup?
2) The program crashes as it tries to free memory and I would like to
know the best way to correct...
|
thread by: Tim Cambrant |
last post Nov 13 '05 by: Tim Cambrant
Hello, I'm relatively new to C, although I've touched the subject several
times for a couple of years. Tutorials etc. always taught me that I should
use (in the beginning at least) cin and cout when outputting text to the
screen.
Recently, when giving C another shot with the new GCC 3.3, I couldn't use
the functions defined in iostream.h...
|
thread by: Trying_Harder |
last post Nov 13 '05 by: John Bode
Generally we have function names briefly indicating their actions.
In similar lines I expected `fopen' mean "File Open", fgets "File
Get String" etc.
I was told recently this wasn't the case though with the above
mentioned functions. `fgets' meant "Function Get String" similar
to `fputc' ("Function Put Character") or `fgetc' ( "...
|
thread by: Tony Johansson |
last post Nov 13 '05 by: Glen Herrmannsfeldt
Hello experts!
I question about understanding. I have read a book that says.
If you have an array of integers you know that one element past the end of
the array is legal as address but not to follow. That's ok.
The address to one element past the end of the array is also grater then the
address to the last element.That's also ok.
The...
|
thread by: Uday Joshi |
last post Nov 13 '05 by: Dave Thompson
Hi
look at the code below
/* test.c */
int main(int argc, char *argv)
{
int *x;
*x = 10;
printf("%d\n", *x);
return 0;
|
thread by: Peter Ong |
last post Nov 13 '05 by: Larry__Weiss
Hello,
I'm very new to C. I have followed some of the earlier programs in the K&R
book, but I am still far from even being a novice. For a long time I was
looking for a little support group that I could come to for some guidance,
it seems with this newsgroup I have found that. I've known usenet was the
way to go, but when I started on my...
|
thread by: Vijay Kumar Zanvar |
last post Nov 13 '05 by: Jack Klein
Hello
I have seen in many source files the usage of extern +ACI-C+ACI-.
What is its purpose?
Thanks
VRZ
|
| |
thread by: MC |
last post Nov 13 '05 by: Eric Sosman
Hi
If I have a pointer to a some structure
say for example payroll_ptr where
struct payroll { ... } has some members and
if i use a function argument as
int function_process ( (payroll_ptr) 0 , ..)
does the first argument become a NULL
pointer ?
|
thread by: Michael Hiegemann |
last post Nov 13 '05 by: Michael Hiegemann
Hello,
I am unaware whether this is the right group to ask. Please point me
to another forum if required.
I would like to replace a Fortran function by one which is written in
C. The function shall provide the same interface for the fortran code
calling the library. Fortunately, this works - currently under WinNT -
well for all functions...
|
thread by: Tom Carroll |
last post Nov 13 '05 by: Christian Bau
When assigning or testing equality between a type and a constant,
should the constant be casted to the type?
I.e.
should fork() == -1 be written as fork() == (pid_t)-1?
should uid = 45 be written as uid = (uid_t)45?
Is the casting necessary? Does it increase portability? Browsing
some projects, I noticed that -1 is casted but not other...
|
thread by: Hilary Cotter |
last post Nov 13 '05 by: Eric Sosman
I'm trying to replace the characters in a pointer from an url string.
Here is my code.
// string has embedded '+', this code will not work.
VOID PatchQuery(char *szQuery, char **ppszPatchedQuery)
{
char *p = szQuery;
while (*p++)
|
thread by: Steve Zimmerman |
last post Nov 13 '05 by: Tom Zych
I have dramatically improved my programming skills
since becoming involved with clc, and this improvement
is a direct result of my involvement with clc.
Thanks to all.
--Steve
|
thread by: Robert |
last post Nov 13 '05 by: Robert
Hi,
I am new to c and use to program in basic before so i was
wondering why this isn't working:
char geturl(char *header, int client)
{
char *url;
char *filename;
char *tmpstring;
|
thread by: Robert |
last post Nov 13 '05 by: Robert
Hi,
I am new to c and use to program in basic before so i was
wondering why this isn't working:
char geturl(char *header, int client)
{
char *url;
char *filename;
char *tmpstring;
|
thread by: Koster |
last post Nov 13 '05 by: Joe Wright
Just a quickie: I heard that arrays declared in the global scope are
automatically initialised with a block of zeros. To help with making my C
source compatible with multiple compilers, I'd like to know if this is a proper
ANSI-C thing or just another C++ quirk that only confuses people, if it's true
at all.
Thanks for your time,
Koster.
|
| |
thread by: sieg1974 |
last post Nov 13 '05 by: Ben Pfaff
Hi,
how can I compare one character of a string to a char?
I have tried this to compare the first character of directory to '/',
but when I run this program I got a segmentation fault.
void makeBaseDir( char * directory )
{
if( *directory == '/' )
printf( "YES\n" );
|
thread by: Lord |
last post Nov 13 '05 by: Malcolm
Hello all,
Say I have a file called "error.log" that I wish to send to the
printer. How would I print the file to the printer? I found out I can
use the SYSTEM function and send a command like
PRINT error.log
but that command is displayed on the screen which I don't want. I
would rather use some sort of c rountine if possible. I am...
|
thread by: mike79 |
last post Nov 13 '05 by: Default User
Hi all,
I have attempted to implement a queue in C.
So far all is well, but I have a question to ask you experts in
regards to my implementation.
Say I have a queue of integers. My queue will be an array of integers
which could hold 100 elements for example.
|
thread by: Andrew |
last post Nov 13 '05 by: Jack Klein
Hello,
Is there anyway to detect when scanf implicitly casts a value? If I
have a scanf call which expects a float and is passed a double I
believe that testing the scanf call with if(scanf("%f",&val) == 1)
would be true, but the double would have been truncated to a float. Is
there anyway to flag this cast? Thanks
|
thread by: Shi Jin |
last post Nov 13 '05 by: Glen Herrmannsfeldt
Hi there,
I am now having a puzzle regarding what a function call actually does when
called.
I have a simple code to see what's going on. It is simply calling another
simple function from main().
The disassembled code for the function under linux (with gcc) looks like this:
pushl %ebp ;push old %ebp
movl ...
|
thread by: Tim Quon |
last post Nov 13 '05 by: Dan Pop
Hi
I have a pointer to char and need to replace a string inside with
another string. Something like that:
char* str_replace(const char* oldString, const char* toBeReplaced,
const char* replaceWith);
How can I code the function if the string is of dynamic length?
|
thread by: DAVID SCHULMAN |
last post Nov 13 '05 by: John L
I've been trying to perform a calculation that has been running into
an underflow (insufficient precision) problem in Microsoft Excel, which
calculates using at most 15 significant digits. For this purpose, that
isn't enough.
I was reading a book about some of the financial scandals of the
1990s called "Inventing Money: The Story of...
|
thread by: Sona |
last post Nov 13 '05 by: Pushker Pradhan
I understand the problem I'm having but am not sure how to fix it. My
code passes two char* to a function which reads in some strings from a
file and copies the contents into the two char*s. Now when my function
returns, the values stored in the char* are some garbage values (perhaps
because I didn't allocate any memory for them).. but even if...
|
| |
thread by: Koster |
last post Nov 13 '05 by: Koster
Sorry for the re-post, but my previous question was left unanswered.
I have a question about the appropriateness of calloc. Consider an array of
pointers to structs which need to be allocated space on the heap, for example:
typedef struct myStruct *PMYSTRUCT;
struct myStruct
{
int i;
int j;
|
thread by: Robert |
last post Nov 13 '05 by: Morris Dovey
Hi,
Is there some way of using an array of strings? Like in basic?
I know you have to create an array of chars so i think it has to
be an 2d array or something...
Really stuck here... Thanks in advance,
Robert
|