15,551 Topics

Member Avatar for
Member Avatar for AndrewYY

For the sake of readability, I've been trying to do something like this: [CODE]#define initialize(x)(type x = initfunction()) int main(){ initialize(example); example.item = 0; return 0; }[/CODE] where type is a typedef'd struct, and initfunction() generates one, inits values, and returns it. My problem is, I get these errors: warning: …

Member Avatar for 0x69
0
3K
Member Avatar for COKEDUDE

Here is a good listing of library functions. [url]http://www.cplusplus.com/reference/clibrary/cstring/[/url]

Member Avatar for COKEDUDE
0
91
Member Avatar for skypower

Hello, I am having some strings grammar problems. [CODE] char *eisodos1[50]; char e; int *a; int i; int main() { eisodos1[i]=getchar(); (1) e=eisodos1[i]; (2) if (eisodos1[i] == ' ') g++; (3) while ((e!=EOF) && (a!=EOF)); (4) } [/CODE] Please don't look the code like a complete program, I posted the …

Member Avatar for eager
0
190
Member Avatar for shekar.bdn
Member Avatar for skyspace_as
-2
96
Member Avatar for stirredo

have just "finished" learning C. By finished, I mean I have learned all the basics in plain vanilla C (command prompt style). I want to get into windows developement so that i can create something useful. What should be my next step? Should i be learning a object oriented language …

Member Avatar for Ancient Dragon
0
72
Member Avatar for BabyPink

Hi guys, I badly need ur help.. well am nt zat gud in C programming. I've gt an assignment on a Video Club. To maintain 'its list of videos,the number of copies available for rental, the rental price, date on loan, the return date. Each video record should be represented …

Member Avatar for Ancient Dragon
0
84
Member Avatar for Reprise

I have the following code which basically acts as a typewriter: [code] int main () { char c; puts ("Enter text:"); do { c=getchar(); putchar (c); } while (!feof(stdin)); return 0; } [/code] However when I feed it a text file for input: [icode]$ ./typewriter < input.txt[/icode] it always adds …

Member Avatar for Reprise
0
91
Member Avatar for chained

Suppose if I have a dynArr pointer and a file pointer as parameters, and in the DynArr I am storing a TYPE with an integer value and a string description. How would I put the TYPEs in the DynArr into a txt file while tabbing between the string and the …

Member Avatar for chained
0
124
Member Avatar for tcotto

Hi I've been taking a python course and now that were done the professor wants us to write a program to list all the prime numbers from 2 - 10000. Oh yea and it has to be in C. So I am very stuck and really need help. Heres the …

Member Avatar for 0x69
0
99
Member Avatar for barevhayerable

Hello everybody, is there somebody that can help?? I'm having string (my example in string 55+22)that must be inputed by keyboard .. the first part I've done to put 55 to another array 2(with strtok function) Now that I was tries for many hours to put 22 to an other …

Member Avatar for abhimanipal
0
381
Member Avatar for purvi12345

it prints the integer string b.var CORRECTLY.BUT not it's individual integer constants.....WHY? (ABCD.TXT is a bin text file containing data 10110000)[code]#include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> struct st { int var[8]; }; struct str2 { char a1; float a2; int a3; int a4; char a5; char a6; int a7; char a8; }; …

Member Avatar for abhimanipal
0
152
Member Avatar for jeeter19

Hi, I'd like to copy one directory to another, including subdirectories. Each file that is copied over needs to have its own thread and each following thread must wait for the previous one to finish and exit before being created. The directory names are passed in *arg separated by a …

Member Avatar for abhimanipal
0
107
Member Avatar for notuserfriendly

I am coding 2 dynamic arrays. basically ive done the first part which requires the user to enter rows and columns, i also implemented the functions to print and fill the created arrays. now the next task is to create a SINGLE dimensional array with enough size to fit the …

Member Avatar for notuserfriendly
0
375
Member Avatar for rickymak

Why is it that in this statement "c = '\t'" is not "c == '\t'" (an additional equal sign). I read an explanation that it is because \t is a visual representation of the tab character. Isn't \n and ' ' also visual representations of a newline and space character …

Member Avatar for tux4life
0
111
Member Avatar for centrinostyle
Member Avatar for rickymak

int c; c = getchar(); while ((c = getchar()) != EOF) putchar(c); c = getchar(); I know EOF means end of file. Basically, I believe this functions is instructed to keep inputing text from the keyboard until EOF becomes the subsequent input. However, I am not sure what EOF is …

Member Avatar for Aia
0
190
Member Avatar for rickymak

This program here is supposed to count the number of occurrences blanks, tabs and newlines within the respective text you type within the program. However, after I compile the program and run it on ubuntu's terminal, all I am able to do is punch in text, space, enter etc... endlessly …

Member Avatar for tux4life
0
218
Member Avatar for rickymak

Quick question: what does "if(c == '\n') mean in this context? Is it just using '\n' as a reference for a numeric value within ASCII? which in that case would be 10, so if 10 is entered, this is when nl increments up one? { int c, nl; nl = …

Member Avatar for rickymak
0
316
Member Avatar for camdaddy09

As you'll notice this is an assignment from my computer science class, and if you look closely you'll also notice that this was due on march 3, so im not trying to get help for it. All this is for is to create some friendly competition and maybe keep the …

Member Avatar for BestJewSinceJC
-2
148
Member Avatar for mr.confused!

i'm having trouble creating a craps game for school, i'm a light weight c user and any help would be amazing!!!

Member Avatar for UncleLeroy
0
113
Member Avatar for friendfx

Hi there, recently I wrote a small C program utilising the Windows API to communicate with a device over the serial port (COM1, a real serial port of my PC). This worked fine, but I am aware of the fact that those real COM ports are replaced more and more …

Member Avatar for Jason Guo
0
2K
Member Avatar for ajithasati

Hi there, On executing the above code I'm getting the error "segmentation fault". Is it possible to manipulate a string variable which already contains a data?[code]#include<stdio.h> int main() { char *str="Hello"; char * str1 ="World"; strcpy(str,str1); printf("%s",str); }[/code]

Member Avatar for abhimanipal
0
67
Member Avatar for leway

I can't seem to figure out the code you are missing. Any help getting the below code working would be great. [code]#include <stdio.h> #include <stdlib.h> #define SIZE 2 // initially to test kept it to SIZE 2 typedef struct { char firstName[30]; char lastName[30]; char street[35]; char city[20]; char state[3]; …

Member Avatar for abhimanipal
-1
131
Member Avatar for hassall

Have been programming in Turbo C for some time using an XP platform. I have recently bought a new computer also with XP and Turbo C programmes will not run on it. Has XP been modified recently? Is there any solution other than going back to 98? Thanks Cliff

Member Avatar for hassall
0
208
Member Avatar for Dave Sinkula

Never use the function [inlinecode]gets[/inlinecode]. Why? It is unsafe. Since the maximum string size cannot be specified, it is always susceptible to buffer overflow. This snippet shows one way to do a safe version of [inlinecode]gets[/inlinecode]. It reads characters from the [inlinecode]stdin[/inlinecode] into a string up to the specified size …

Member Avatar for Narue
0
2K
Member Avatar for OzY360

Hi i am doing C programming in netbeans and when i compile and run my program i get a message in the dos console that says i need to use the nodosfilewarning to disable the cygwin warning i am getting. I have attached a screenshot as it is a rather …

Member Avatar for baxilo
0
2K
Member Avatar for camdaddy09

ive seen this in code on different forums but i have no idea what it does, could someone explain this?

Member Avatar for omol
-4
107
Member Avatar for krap_nek

hi guys, I'm trying to implement a basic program which deals with structures and pointers. I have to insert data for various citizens, which is structure that have other structures as fields. in this case my main objective is to create 2 general functions that will get the information for …

Member Avatar for UncleLeroy
0
166
Member Avatar for nshh

Hi, please answer me the following questions. It will be very useful for me...Thanks in advance. c questions: 1. storage classes (auto, register, extern, static) in c with these informations (scope, lifetime, default value and memory location(where it stored in memory)). 2. why should we use static in function prototype …

Member Avatar for UncleLeroy
0
132
Member Avatar for lionaneesh

Sir/Maam, please suggest me some very simple tutorials explaning right from the basics of such functions . I am doing C since 6 months and was looking at a tutorial of BEEJ's guide to network programming.. there at looking at a source code i found these functions and am really …

Member Avatar for UncleLeroy
0
108

The End.