15,550 Topics

Member Avatar for
Member Avatar for donaldunca

I have some problems: - How can I erase a file? - How can I create a random string has 8 letters? This is my code to create a random string has 8 letters: [CODE] char *b=""; int i,j; FILE *f=fopen(file,"w"); for(i=0;i<4;i++) { for(j=0;j<7;j++) *b+=char(random(27)+65); fprintf(f,"%s\n",&b); } fclose(f); [/CODE] But …

Member Avatar for Ancient Dragon
0
105
Member Avatar for redaqen

EDIT: Please note, this assignment was already submitted. Well for our assignment this time around, we had to write up a BASIC editor. It had to sort lines of code numerically. Each line would never be more than 80 characters long and there would never be more than 100 lines. …

Member Avatar for Ancient Dragon
0
150
Member Avatar for asilter

unsigned int is 4 bytes in the system i'm programming. i printed sizeof(unsigned int) and it said 4. [code] int main(int argc, char * argv[]) { unsigned int a = 0; long int b = 2607503366; /* the b data type must strictly be a long int */ a = …

Member Avatar for Salem
0
112
Member Avatar for asilter

[code] unsigned int nBolum = 0; unsigned long nKalan = 0L; unsigned long ulA = 0L; unsigned long ulB = 0L; ... printf("ulA=%u\n",ulA); printf("ulB=%u\n",ulB); nBolum = (unsigned int) ulA/ulB; nKalan = (unsigned long) (ulA%ulB); printf("nBolum = %u\n",nBolum); printf("nKalan = %u\n",nKalan); ... [/code] it prints; [code] ulA=2607503366 ulB=16777215 nBolum = 155 …

Member Avatar for Salem
0
152
Member Avatar for asilter

[code] unsigned long nBolum = 0L; unsigned long nKalan = 0L; unsigned long ulA = 0L; unsigned long ulB = 0L; ... printf("ulA=%u\n",ulA); printf("ulB=%u\n",ulB); nBolum = (unsigned long) ulA/ulB; nKalan = (unsigned long) ulA%ulB; printf("nBolum = %u\n",nBolum); printf("nKalan = %u\n",nKalan); printf("HVFE.c exiting\n"); exit(1); [/code] it prints : [code] ulA=2607503366 ulB=16777215 …

Member Avatar for asilter
0
3K
Member Avatar for Ratte

I have a file of 14 functions. I know I need an extern array of 14 bools. If something goes wrong in one of these functions, the function should modify its respective array member to false. I want the main program to be able to access the array members to …

Member Avatar for WaltP
0
96
Member Avatar for nikolaos

i have the following struct [code] typedef char * typos_stoixeiou; typedef int metritis; typedef struct korifi *kdiktis ; struct korifi { typos_stoixeiou dedomena; metritis counter; int kleidi; int arithmospaidiwn ; korifi *a[100]; }; [/code] if i try this [code] for(int s=0;s<size;s++) { root->a[s] = (kdiktis)malloc(sizeof(struct korifi)); root->a[s] = NULL; }[/code] …

Member Avatar for Duoas
0
159
Member Avatar for Ratte

I need to write wrapper functions for fork and signal functions. These functions will handle errors by fork() and signal() and exit, if an error occurs. The problem is I am not sure exactly what to check for on either function. Here is some sample code for both of them. …

Member Avatar for Ratte
0
460
Member Avatar for Ratte

I am writing a server function and an error message is defined as: [code] #define UNKNOWN "Unknown" [/code] I have a function: [code] void search(int sockfd) { FILE *file; char arg1[MAXLINE], arg2[MAXLINE], title[MAXLINE], line[MAXLINE]; file = Fopen (PATH, "r"); while (true) { if (Readline(sockfd, title, MAXLINE) == 0) return; Fgets …

Member Avatar for iamthwee
0
147
Member Avatar for toxic

hello. i'm new here and new to C programming so would appreciate any help with a problem i have. how can i copy the contents of a command line argument e.g. argv[1] to a string declared within main() e.g. filename[30] cheers..... PS this isn'y my homework:lol:

Member Avatar for Duoas
0
17K
Member Avatar for phylon

Hello I am having no problem while returning 1 dimensinal array But am having trouble with 3 dimenional array No problem with this code [CODE]float Mat[][][]; float Mat[]; float *funct1(void) { return Mat; } void funct2() { float *Mat; Mat=funct1(); } [/CODE] But this doesnt work [CODE] float Mat[][][]; float …

Member Avatar for mank
0
98
Member Avatar for piscean123

Can anybody give me the source code of ANY of the following programs.... me newbie to C.... 1. Write a program which takes 10 numbers as INPUT and tell which one is GREATER. 2. Write a program which takes 10 numbers as INPUT and tell which one is SMALLER.

Member Avatar for piscean123
0
98
Member Avatar for pogosecure

Please help me to resolve my problem. How to print a set of character in bold form in "c" or "c++" language.

Member Avatar for Duoas
0
41
Member Avatar for muwaheedibrahim

can ayone share his knowledge related with hardawre and networking with me so that i earn my livelyhood from the start and in return ill pray from THE ALMIGHTY for increase his knowledge! thanks

Member Avatar for Ancient Dragon
-2
30
Member Avatar for chorei

hey all i have a real problem with fibonacci numbers i have calculated max fib(47) with my codes but i have a project that i need to calculate the n'th fib number which is get from the user and print the fib valu to the screen the numbers must be …

Member Avatar for iamthwee
0
244
Member Avatar for #include_rose

I keep getting this warning every time I compile the following code. Can anyone please tell me what I am doing wrong. Also, the printf(head->data) keeps saying that printf's argument is invalid. How do I print head's data? Any help is appreciated. Thanks, [CODE]#include<stdio.h> #include<malloc.h> typedef struct { int data; …

Member Avatar for #include_rose
0
291
Member Avatar for Aarthi Gopal

i had a prob wen i had to sort each column of a matrix. the prob s wen i use larger values say 2453,23465 etc. the sorted matrix returned garbage values.. y s that? n how do i find factorial for 300 n bigger numbers?? i'm not able to store …

Member Avatar for Ptolemy
0
105
Member Avatar for n.aggel

hi, i want to begin socket programming and interprocess communication but i don't where to begin....can anyone suggest some sources?? thanks in advance, nicolas PS:: sorry if the question is vague, but it isn't easy to be more specific....

Member Avatar for stupido
0
187
Member Avatar for locy

How do i write a programm that the given text.the longer the text will factorized (in primenumber order).The text is for the following transformation as matrix with the Dimention [B]n[/B](breath;smaller Primefactor) multiply [B]m[/B](highest;bigger Primefactor).The letters of this matrix will in column by column displayed the output format is the transpose …

0
80
Member Avatar for turkgames

I made a program in C for my school work but i cant make it work.Piglatin means cutting the first character of a word and adding it to the end and finally adding an "a" to the end.For example teacher -> eacherta. Can you help me finding the problem? [code=c]/***************************************************************************************/ …

Member Avatar for WaltP
0
97
Member Avatar for mank

I want to pass a float array from one function to another function I want to make use of the float array type(here container) [CODE]void funct1() { float container[4]={0.1,0.2,0.3,0.4} void funct2() ----(1) {return container;} } void funct3() { void funct2(); use container array; }[/CODE] Here what would be the funct2() …

Member Avatar for mank
1
2K
Member Avatar for hotice187

hi I use Turbo C compiler in my school (Gujarat, India) Our course based on book E.balagurusamy there is no description of array like this int a[3,2] can ne 1 plz tell me how it is different from normal 1d array ? n how d values r stored in that …

Member Avatar for Salem
0
103
Member Avatar for cwtliew

Hello! I'm practising 2d-arrays for my upcoming test so pls help! i cant figure out what went wrong :((((( Q: A factory has 3 divisions and stocks 4 products. An inventory data is updated for each division and for each product as they are received. The current inventory data is …

Member Avatar for cwtliew
0
92
Member Avatar for the.alchemist

Hello. Here's my structure: [code=C] struct settings { char setting[40][255]; }; [/code] Here's the function that is supposed to take a pointer to an instance of the above structure and modify it : [code=C] void changeSetting(struct settings *tempSettings, char *newValue, int indexValue) { if( indexValue<40){ // to avoid out of …

Member Avatar for Salem
1
112
Member Avatar for donaldunca

I have small question: How can I create a random string from 'a' to 'z'? thank you!

Member Avatar for donaldunca
0
158
Member Avatar for jammy's

Hello can some one say how to use tracing in turbo c and to show the trace like we do manully is their any function how do watch options work plz say me i am a student and beginner in c guys help me experts professional and any one plz

Member Avatar for Fast
0
95
Member Avatar for appuguy

Hi could you please tell me how to print array elements with spaces. Please provide an example. I would like to see how a 2 D array is printed.Thanks a lot

Member Avatar for Aia
0
112
Member Avatar for crunchycrisp

For an assignment that im working on, we needed to accomplish the following: Asks the user for their name, accepts and stores the answer as a string. Opens a text file: questions.txt for reading �Opens a text file: studentName.ans for writing, where studentName is the one entered Reads each line …

Member Avatar for Aia
1
149
Member Avatar for theteamdrunk

I am trying to write a program that has to create a structure that has one variable called value and one pointer to the list(making it a linked list). It need to prompt the user for 5 values and store them into the linked list, then print out the list. …

Member Avatar for Duoas
0
100
Member Avatar for sarwar

Hi, I am seeking your help on following pthread_create issue on linux OS. The senario is I have a main program which generates new child threads on user request.The new child executes a module and closes. It is working perfectly if there are less then 245 new threads after that …

Member Avatar for Salem
0
175

The End.