473,543 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C / C++ Forum

C / C++ programming language - Get answers to questions about compilers, visual C++, templates, namespaces, classes, data structures, OOP (object-oriented programming), inheritance, data types, exceptions, Standard Template Library (STL) and the C Standard Library.
5
346
thread by: Kieran Simkin | last post Nov 14 '05 by: Kieran Simkin
Hi, I wonder if anyone can help me, I've been headscratching for a few hours over this. Basically, I've defined a struct called cache_object: struct cache_object { char hostname; char ipaddr; };
5
977
thread by: silentlights | last post Nov 14 '05 by: E. Robert Tisdale
Hi, Is there a possibiliy to improve division or Modulo operations in the following, tmp1 = 123; tmp2 = 123; frame = ((char)((tmp1/100)+48)); // Division tmp1 = (tmp2 % 100); // Mod frame = ((char)((tmp1/10)+48)); tmp1 = (tmp2 % 10);
5
337
thread by: Andrew Arro | last post Nov 14 '05 by: Dave Thompson
first of all i would like to thank Alexander Bartolich and Richard Heathfield for answering my "macros question" #1 another macros question now: how could i define a macros with variable number of parameters? i want to create
5
265
thread by: Peter Ammon | last post Nov 14 '05 by: Peter Ammon
It's my understanding that the printf() function is declared as int printf(const char * restrict format, ...); in stdio.h. And loosely speaking, if a parameter is declared as restricted, then accesses to the object must go through that parameter. Does this mean that printf("%s", "%s");
5
1,474
thread by: google | last post Nov 14 '05 by: Dan Pop
first, a little background... i have a C program which preprocesses some data, and then outputs the results into a text file. that text file, in turn, is used as input to a FORTRAN computational fluid dynamics (CFD) program. the FORTRAN program goes to work on the provided data, and outputs a text file which i read back in with another C...
5
287
thread by: Bill Cunningham | last post Nov 14 '05 by: Julien Oster
In comp.programming I asked for advice for writing a parser. The code someone showed me wouldn't compile. I don't know what's wrong. I just want to write the simpliest of parsers. int parser(FILE *in,FILE *out); int main(void){ parser(stdin,stdout); return0;}
5
342
thread by: sworna vidhya | last post Nov 14 '05 by: Nick Keighley
Hai, When viewing threads of comp.lang.c, I came across with 'static const char * const resultFileName = "param.txt";' . Here in this thread, 'static const char * const resultFileName = "param.txt";' is declared globally. a) What is the use of declaring a global variable static? b) Why in this thread they had use "const" the two times?...
5
411
thread by: matevz bradac | last post Nov 14 '05 by: matevz bradac
Hi, I'm trying to implement delayed function execution, similar to OpenGL's display lists. It looks something like this: beginList (); fcn1 (); fcn2 ();
5
2,744
thread by: Hal Styli | last post Nov 14 '05 by: Eric Sosman
Hello, can someone please help with the following attempt at defining a macro ... I want to wrap the following in a macro:- if HEAD is defined then head=p; define HEAD else tail->next=p;
5
9,554
thread by: pembed2003 | last post May 1 '06 by: BatteryCell
Hi, I have a question about how to walk a binary tree. Suppose that I have this binary tree: 8 / \ 5 16 / \ / \ 3 7 9 22 / \ / \ / \
5
401
thread by: Michael | last post Nov 14 '05 by: Michael
In the past I have developed many micro-controller products using assembler. I have recently started using C, and so far I love it! I am very motivated to learn and become accustomed to the language. I have a couple of simple questions; just to make sure I'm not going about things the wrong way. When writing functions that handle four...
5
1,578
thread by: Jason Kilgrow | last post Nov 14 '05 by: Joona I Palaste
Does anyone have a simple working example of how AIX implements getsubopt? I have a program that runs on lots of different platforms (linux, tru64, hp9000) and getsubopt works the same on all of those but, for some reason, it refuses to work when I port it to AIX. I've done a lot of debugging and I've determined that I have a problem when I...
5
1,311
thread by: aruna | last post Nov 14 '05 by: Vijay Kumar R Zanvar
How do I check the size of int on a machine before runtime, at the pre-processor stage? Is it possible?
5
1,687
thread by: Booted Cat | last post Nov 14 '05 by: Booted Cat
I've seen lots of discussions on the proposed inclusion of "function call with named arguments" to C/C++ on these newsgroups. My proposal is slightly different in that: * No ANSI approval is needed * No conflicts with existing language features such as function overloading * No need to modify the language spec or the compiler * No need to...
5
1,086
thread by: pembed2003 | last post Nov 14 '05 by: Joona I Palaste
Hi, I have the following: #inclue<stdlib.h> struct person{ public: person(){name = malloc(6); strcpy(name,"peter");} ~person(){free(name);} const char* getName(){return name;}
5
1,090
thread by: Patrick | last post Nov 14 '05 by: Keith Thompson
I have the following problem, (1) I have an 8-Bit microcomputer (2) It has an integer word size of 2bytes (=16 bits) (3) So int type is in the range -32768 to +32767 (4) Now I want to add numbers of type int, in the range 0 to 50000 How do I deal with the range limitation here? I can ONLY use int type.
5
1,489
thread by: Dave | last post Nov 14 '05 by: John Bode
Compiled using g++ on linux and then I tried to execute it on Solaris. The error message was something like "can't execute a.out" - works ok on linux - ran chmod so Sun user has execute/read/etc permissions. chmod u=rwx Any clues why? I am new to the non windows world. Thanks
5
10,265
thread by: ZAPPLE | last post Nov 14 '05 by: ZAPPLE
Hi friends, Actually I want to know the jpeg header( data structure). So that I can access the information in the header file. Even if you just post the website where the information may be it would be great. Thanks in advance ZAPPLE - MY computer is clever than me.
5
4,134
thread by: Bill Carson | last post Nov 14 '05 by: CBFalconer
I'm trying to dynamically allocate memory to an array of strings with the following (incomplete, for reference only) : int nLines, nChars, m, n, Cols.sTcolumn ; char ***sAtt; sAtt = (char ***)malloc(nLines * sizeof(char *)); for(m=0; m < nLines; m++) {
5
1,174
thread by: macluvitch | last post Nov 14 '05 by: macluvitch
Hello folks, During developping I've met a problem this is how it looks like I have an expression like this (type *)var + 1 Wath heppens is I want to make a pointer to this
5
1,169
thread by: j0mbolar | last post Nov 14 '05 by: Thomas Stegen
I was looking over some code and came across this: new_time = mktime(&tm); if(new_time == (time_t)-1) goto err; is this cast necessary in a strictly conforming program?
5
20,472
thread by: Gautam | last post Nov 14 '05 by: CBFalconer
i was thinking of declaring a string . . two ideas came in my mind i) char a = "ilovemyc"; ii) char *p = "ilovemyc"; how can we differentiate the above two declarations?
5
2,729
thread by: aruna | last post Nov 14 '05 by: Karthik
What are the advantages of using volatile? What are the practical situations where you use volatile specifier?
5
306
thread by: news.hku.hk | last post Nov 14 '05 by: Darrell Grainger
can any one translate the following codes into c++ codes, coz i can't run the "printf" command in Unix and it said it's implicit declaration. Is it only the two lines with comment need to be re-written?? Thanks a lot void _display_number(int v, int n){ if(v >= 1000){ int r = v % 1000; _display_number(v / 1000,n); printf(",%03d",r); ...
5
5,593
thread by: Alberto Giménez | last post Nov 14 '05 by: Arthur J. O'Dwyer
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I have a simple question, and after a *very long* google search I still can't get it. It's about generic abstract data types (for example, a list). I've coded it in ADA, and its quite easy to do, but there is a thing I cannot decide when doing it in C. This is about the actual data...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.