15,554 Topics

Member Avatar for
Member Avatar for snedan

hi guys i need a little hint on how to break an integer into its component so if you have like 1567 i need to get 4 integers with 1,5,6,7. Thank you

Member Avatar for ~s.o.s~
0
98
Member Avatar for ramyasree

[code=c]struct DATA { pid_t pid; int lenth; char buff[128]; }; main(int argc, char* argv[]) { int pos,chlds,fd[2],ifd,ofd,i,n,nofreads[50]; struct DATA data; pid_t pid,child[50]; FILE *fp; pipe(fd); chlds=atoi(argv[1]); ifd=open(argv[2],O_RDONLY); for(i=0;i<chlds;i++) nofreads[i]=0; for(i=0;i<chlds;i++) if((pid=fork())==0) { // ONLY CHILD COMES HERE close(fd[0]); data.pid=getpid(); while((data.lenth=read(ifd,&data.buff,128))>0) { write(fd[1],&data,sizeof(data)); //sleep for random time (0-chlds seconds) sleep((rand()%10)+1); } …

Member Avatar for WaltP
0
183
Member Avatar for Dextral

Hi, I'm updating an IM client C app (for Windows XP) so that when a users screensaver comes on their presence state changes from online to away. What I've done so far is add: [code=C] while(TRUE){ refreshAutoAway(); Sleep(1000); } [/code] to the end of the WinMain function. This all does …

Member Avatar for Ancient Dragon
0
91
Member Avatar for rxgmoral

dll problem,help me:) i create dll project ,the dll is Use MFC in a Static Library i hope exe call ListCtrl class from dll ==================DLL==================== <<<<<<<<<<ListCtrl.h>>>>>>>>>>>>>>> [code=c] #pragma once class AFX_EXT_CLASS ListCtrl :public CListCtrl { public: __declspec(dllexport) ListCtrl(); __declspec(dllexport) ~ListCtrl(); public: DECLARE_MESSAGE_MAP(); public: afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); }; …

Member Avatar for Ancient Dragon
0
181
Member Avatar for s88

The problem is that when I enter the choice, nothing happens and the answer remains 0. Please help I'm new at this and I tried everything!! Thanks [code=c] #include <stdio.h> #include <conio.h> main () { int a,b; float answer; char choice; clrscr(); printf ("\nEnter a number: "); scanf ("%d",&a); printf …

Member Avatar for s88
0
291
Member Avatar for clemente

In response to Hike34's thread to add a \ character to a CString, I think the \ character has a meaning in such strings and to use it in a string it should itself be preceded by a \ character CString word="hello world"; word+="\"; // or "''" doesn't work... Instead …

Member Avatar for ~s.o.s~
0
98
Member Avatar for pointers

Hi i hav executed the following c code..the inner printfs executes first and prints some garbage value...why dont the outer printf prints anything... i got only one garbage value y dont two garbage values....wt s the order of precedence in printf function and in nested printfs.... the c code is …

Member Avatar for ~s.o.s~
0
100
Member Avatar for sgriffiths

Hello can anyone help me with the following The below will actually display the Name found part, even though no name actually exists and its just blank, how do i get round this, the string name will contain blanks, but i need to check if blank, then treat as blank. …

Member Avatar for Nick Evan
0
106
Member Avatar for Manas Kumar Sen

The following profram is not compiled. Why? Please help me! //This is a file copy utility// [code] #include<stdio.h> #include<conio.h> main(int argc, char argv[]) { FILE *fs,*ft; char ch; if(argc!=3) { puts("Insufficient Arguments!"); exit(); } fs=fopen(argv[1],"r"); if(fs==NULL) { puts("Cannot open Source file"); exit(); } ft=fopen(argv[2],"w"); if(ft==NULL) { puts("Cannot open Source file"); …

Member Avatar for Nick Evan
0
79
Member Avatar for waldis

Hi, Once I had a similar problem when I tried to read a binary file on a pc and I failed, but I was able to read it in Linux (there were actually different versions of the file), so I figured it's a corrupted file, thou the hex dump looked …

Member Avatar for waldis
0
95
Member Avatar for simmyhp

Hi, I have written the code of checking already, but I have got two problems here. 1. I don't know why when I enter the number in, when it prints out the number, it becomes smilies or some kind of maths code. Please tell me what I have done wrongly …

Member Avatar for WaltP
1
100
Member Avatar for kissiwat

All I'm trying to do is write a very simple loop program in C to enter the ages of four sprogs between 5 and 7. To display their total and average age using do, while and if statements. I also need to display an error message if an invalid number …

Member Avatar for Lerner
0
140
Member Avatar for depsch

I have a basic question with a for loop statement where I have a function thats creating input nodes inside my animation program. The name thats assigned to the input that the function creates is "InputNum" . How do I tack on the value of i to the end of …

Member Avatar for WolfPack
0
111
Member Avatar for rxgmoral

problem about font i write CMFont class,it inheritance CFont e.g: [code] class CMFont:public CFont {..........}; ======================== CMFont font; font.CreateFont(...); GetDlgItem(IDC_FONTID)->SetFont(&font);[/code] [code] error error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *'[/code] how to CMFont convert CFont thank:)

Member Avatar for Ancient Dragon
0
89
Member Avatar for Raj@web

[B]Hey i have been working C, But i need to do a Convolution progrm in C, So pls advice on this matter How to initialize..[/B]

Member Avatar for Salem
0
96
Member Avatar for kimw

does anyone know how I can write to a xls that puts each number in different cells? for example, [CODE]vector<int> nums; nums.push_back(1); nums.push_back(2); nums.push_back(3); ofstream myfile; myfile.open("C:/example.xls") myfile << nums[1] << " " << nums[2] << " " nums[3] << endl; myfile.close()[/CODE] how do i put three numbers in different …

Member Avatar for Salem
0
133
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it#include#define …

Member Avatar for Salem
0
276
Member Avatar for tomtat

[code]/* a program to find all the permutations of an input string pointers are not allowed*/ #include <stdio.h> #include <string.h> #include <conio.h> void main() { clrscr(); int num =0; char buff[20] ; printf("Enter the string\n"); scanf("%s",buff); int len = strlen(buff); printf("%s\n",buff); for(int i=0;i<len;i++) { for(int j=1;j<len;j++) { for(int k=j+1;k<len;k++) { …

Member Avatar for ~s.o.s~
0
98
Member Avatar for pointers

could u tell me the use of static storage class before a function...like static add(); could u tell me a good link to get collection of programes in c language.... Thnaku and Regards.

Member Avatar for ~s.o.s~
0
86
Member Avatar for neeven

i need to write a program that- allow the user to enter the number of students-allow the user to enter each mark-calculate the frequency for each mark-the interval that exists between identical marksthis is what i have donei want to know if there is a different way of doing it …

Member Avatar for indianscorpion2
0
250
Member Avatar for tirivamwe

the function first search a word from the linked list. if found it then increment the numWords (number of words in listfor that word) and if not found it shoud create a new node for the word. the code is: [CODE]void AddWords( char text[30]) { check=head; while (check!=NULL) { if …

Member Avatar for Nick Evan
0
127
Member Avatar for petzoldt01

Hello, I need to write a program that runs along with an emulator. The goal of my program is to intercept certain keystrokes before the emulator gets them, and then send the emulator back some different keystrokes. I want the program to use as few CPU resources as possible, as …

Member Avatar for iamthwee
0
125
Member Avatar for madankumar

We cannot have static friend function............ because 1.since static member functions can access only static data members...where as friend function can access all the members. 2.Friend function also require an object to access the members...where as static member functions can not. 3. Another thing ....since friend functions are non-member functions....and …

Member Avatar for ~s.o.s~
0
1K
Member Avatar for anksphenomenon

Hi I was goinf through the GTK code and saw that GTK code uses pointer for structs and not normal instances of the same structs... why could this be so? My take is that they wanted to use just one variable name and they can easily initialise the pointer to …

Member Avatar for ~s.o.s~
0
87
Member Avatar for tirivamwe

i have this line of code and want to compare the word from the linked list with the one supplied by user. the code is: [CODE] if (strcmp(p->word,word)==0)[/CODE] and i am having this error: [COLOR="Red"]passing `char' to argument 2 of `strcmp(const char *, const char *)' lacks a cast[/COLOR]

Member Avatar for tirivamwe
0
580
Member Avatar for aismm

I am supposed to use get the user input of a filename and then open that file and print to the screen (the first line-- that I will do later), and I can't figure out what I am doing wrong. Thank you. [code] #include <stdio.h> main() { char s[1000]; printf("Enter …

Member Avatar for andor
0
214
Member Avatar for tehloki

I am taking a programming course, and since we have not been introduced to string functions (puts(), gets(), etc) I need to take some input from the user using scanf. The assignment is to read a DNA sequence, storing it in a char array. The array must be 512 characters, …

Member Avatar for tehloki
0
248
Member Avatar for SammyHasibi

[code]#include <stdio.h> int function1(int a) { return(a*a*a); } int function2(int b) { int i; int sum = 0; for (i=1; i<=b; i++) sum += function1(i); return(sum); } int main () { int n, result; printf("Enter n\n"); scanf("%d", &n); result = function2(n); printf("Result = %d\n", result); system("pause"); return(0); } [/code] Explain …

Member Avatar for SammyHasibi
0
101
Member Avatar for Lun

i don't know why this program doesn't work.. it just keep on saying that it have errors..... pleae help!! please help!! [code] #include <stdio.h> #define LEX_LEN 1024 enum chars{ LETTER, DIGIT, UNKNOWN,ZERO,TULDOK, WHITESPACE,SEMICOLON,QUOTED,PLUS,MINUS, DIVIDE,LT,GT,EQ,ASS2,OPARENT,CPARENT }; enum Token { STOP, NUM, STRING,STMTSEP,QUOTED_CHAR,ERROR,ADDOPERATOR,MINUSOPERATOR,DIVIDEOPERATOR,SIGNEDNUM, SEMI,LTHAN,GTHAN,EQUAL,ASS,OPEN_PARENT,CLOSE_PARENT }; chars charclass; char nextchar; char parse_me[] = …

Member Avatar for Lun
0
143
Member Avatar for tirivamwe

can someone please help me to write a code in c to do the following: 1)read words from a file 2)store the words in a linked list 3)read the words and display 4)count the number of words in list

Member Avatar for tirivamwe
0
126

The End.