15,552 Topics

Member Avatar for
Member Avatar for Akshay nand

a. Write a C program to open and close a file given its name. Your program must check whether or not the file exists. b. Add a function for reading an opened file into an array of characters. You may assume the array is large enough to hold an entire …

Member Avatar for bumsfeld
0
207
Member Avatar for dalaharp

Hi, i would like to calculate the execution time of my program. is there any function available to enable it??

Member Avatar for rustysynate
0
3K
Member Avatar for yaswanth.akula

Hello, I am trying to divide my dataset(iris dataset) into training and test sets randomly. My dataset contains 150 patterns. And I need to divide 90 patterns to test set, and the rest to training set. How can I do this? Help me with the C code. Thank you

Member Avatar for yaswanth.akula
0
154
Member Avatar for die_raupe2

I got this snippet of code from a larger program I've been writing and I'm stuck. All I'm trying to do is read from a file line by line but I keep picking up the new line character, at least that's what I think it is. #include <stdlib.h> #include <stdio.h> …

Member Avatar for die_raupe2
0
300
Member Avatar for fedaa91

hi i am trying to copy the returned value (not really the returnd pointer but what it points at) from function gets but its not working and when i try to print it or print the str_infile before strcpy function , its not printed out !! i added temp_buff before …

Member Avatar for fedaa91
0
164
Member Avatar for penty.kn

main() {--- ---- ---- } main(int a, char **b) {--- --- --- } main can be used in the both the ways in c but if there is no concept of function overloading in c how can the above be achieved.

Member Avatar for Nutster
0
213
Member Avatar for Dave Sinkula

Finding some text and replacing it with new text within a C string can be a little trickier than expected. Here is what I had come up with one day.

Member Avatar for deceptikon
0
1K
Member Avatar for asa88

I am having trouble having redirection working with the ability to hit enter and remain in the same shell. My problem is if user types: ./a.out < foo.txt (where foo.txt contains a command like date) I want to execute that command and exit the shell.However,if the user compiles the code …

Member Avatar for deceptikon
0
362
Member Avatar for Akshay nand

Assignment 1: Simple Text Editor using C programming in Linux Environment The goal of this assignment is to help you practice c programming. A tutorial on Linux commands and c programming is given at the end of this assignment. Resources/examples of c programming is given in Moodle and further help …

Member Avatar for L7Sqr
-1
1K
Member Avatar for straylight

I am trying to devise a program to scheduling "events" onto 3 different stages using dynamic programming. I have a start time a finish time and an interval associated with each event. int max1(int x,int y) { if (x>y) { return x; } return y; } int max2(int x, int …

Member Avatar for Adak
0
462
Member Avatar for enkitosh

I'm very confused about void pointers and this notation here below. I do understand that when you have a void pointer you eventually cast it to some kind of type int, double. What I don't understand is what is happening here : copySize = *(size_t *)((char *)oldptr - SIZE_T_SIZE); copySize …

Member Avatar for enkitosh
0
262
Member Avatar for Fredszky

Server code part: void spawn (char* program, char** arg_list) // Executing the clients command { printf("\n\nprogram = %s\narg_list = %s\n\str1=%s!!!\nstr2=%s\n\n",program,arg_list,str1,str2); dup2(s2, STDOUT_FILENO); //Redericting information to socket dup2(s2, STDERR_FILENO); execvp (program, arg_list);abort (); // Executing the clients command - After this, program gets stuck, why? /* if (send(s2, "This works multiple …

0
211
Member Avatar for anestistsoukalis

I think that the main problem on my code is that iam trying to pass a struct through another struct . Is there a problem if i use "->" instead of (*). ? Because it keeps showing me an error that say's : invalid type of argument '->' Iam trying …

Member Avatar for anestistsoukalis
0
208
Member Avatar for blackrainbowhu

Hello! I'm new here, and I need some help. :) I am working on a program that has to write and read a binary file. I have to add lectures to it, they look like: **COURSECODE;COURSENAME;MAXAPPLICANTS;ACTUALAPPLICANTS;** I could write that in a file without any problems using `char*`. My question …

Member Avatar for Banfa
0
429
Member Avatar for terabyte

what is the difference of passing an array to a function like this function(int x[]){ } or like this(int x*){ } what is the difference both ways seem to work

Member Avatar for deceptikon
0
165
Member Avatar for anestistsoukalis

My friends are keep telling me "Use debugg idiot !" I found out that for a code over 200 lines is very important. But i want to debug only a specific piece of code. And to review the results of a variable while the code is "executing" . Is this …

Member Avatar for anestistsoukalis
0
248
Member Avatar for efxee

I am trying to read a structure from a .dat file...the first integer to be read is the no of readings, then there is the data in following structure format struct Oven { int rec_no; int temp; int status; char string[10]; }; below is the method through which I read …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for ellenski

I am trying to make a compiler for my project using C but I have a problem on how to store the contents of the text file into an array or something similar so that my program can compiler or analyze my txt (code) file. Here is what I have …

Member Avatar for deceptikon
0
278
Member Avatar for radc

Was not sure where to post this, but let this a go. I m on my final year. And I have discovered in myself a passion for programming in C and started learning it but it is all in a beginning stage. I really bored of Java or I just …

Member Avatar for HankReardon
0
323
Member Avatar for AzizTitu

Is it possible to declare an array with a variable as its index value, so that the user himself/herself can enter the exact number of items required....??

Member Avatar for deceptikon
0
240
Member Avatar for emaellie

Hi guy, I have been teaching myself how to write C programming code, right now am learning the Round Robin Sheduling algorithm, below is the code that i have managed to write, its the basic but i could do with your help or your direction with how to do the …

Member Avatar for emaellie
0
248
Member Avatar for laosland_1

I'm having issues with some code that I'm writing for a class homework, which is to write a simple shell for linux. I was wandering if anyone knew a way to convert a char* to a char** in a better way that what I am using. Currently I'm accepting in …

Member Avatar for laosland_1
0
3K
Member Avatar for harshi414

i have an integrated project to build a robot and direct its path via C language im reallly out of this field ! can u just tell me with an idea of basic functioning ! i know this is a c# forun ! but ill be glad if you can …

Member Avatar for Ancient Dragon
0
267
Member Avatar for ellenski

I am learning about compilers right now and search for a source code in C as my guideline to better understand how it works. I found this online from this link [Click Here](http://www.programmersheaven.com/download/16060/Download.aspx) and the code is quite long. Even there are comments in the code, I still find it …

Member Avatar for deceptikon
0
306
Member Avatar for herious89

I'm trying to extract the value of the coeffecients and the exponent from a polynomial. I have already succeeded in extracting the coeffients using strtok. I applied the same concept to find the exponent, but I don't know how to use strtok to extract the string AFTER the delimiters or …

Member Avatar for rubberman
0
926
Member Avatar for anumash

I am writing a program to divide my entire database (which comprises of words(A-Z) and phonemic definitions of the corresponding word on the same line) into small text files that become manageable if they are to be read by an 8-bit microcontrolling unit. The database is sorted. Right now at …

Member Avatar for anumash
0
259
Member Avatar for ram619

Hi, this code is compiling successfully, but giving "segmentation fault" when I am trying to copy data to shared memory. Please tell me where I am wrong. Thanks a lot............ #include<stdio.h> #include<sys/ipc.h> #include<sys/shm.h> #include<sys/types.h> #include<unistd.h> #include<stdlib.h> #include<errno.h> #include<string.h> int main() { int id=-1, status=-1; char *check=NULL; char *p="you"; const size_t …

Member Avatar for ram619
0
426
Member Avatar for Gaiety

Hi, When i debug the program using gdb , the gdb is entering the definations of std lib functions (ex: printf, strcpy ect) and other internal functions. Initially the debuger was working fine, i dont have clue when it got changed.I guess some of the flags of gdb might have …

Member Avatar for Gaiety
0
1K
Member Avatar for MrProgammer

**the SJN and the FCFS will not continue to answer the problem...** **when i choose one of the task listed (SJN and FCFS others are not filled) it proceed to inputting value,** **after inputting the data it exitS or stop.. help me to display the answer..** #include<conio.h> #include<stdio.h> #include<math.h> int …

Member Avatar for Moschops
0
252
Member Avatar for singularity~

# **I am installing OpenCv using these steps:** # Building OpenCV from Source Using CMake, Using the Command Line Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries. Enter the <cmake_binary_dir> and …

Member Avatar for deniscass
0
536

The End.