19,876 Topics

Member Avatar for
Member Avatar for boomerang2711

How to make an application to prevent itself from launching from the command line? I have a binary which should be launched by a daemon; but when somebody tries to launch the binary from command line, I should error out stating "cannot be launched from command line". Tried googling but …

Member Avatar for boomerang2711
0
217
Member Avatar for icepickero

hi can anyone please help me with this problem arranging given input that is alphanumeric in ascending and descending order using turbo c *note the given info are char only example output: info to be arranged: blk4 lot 32 ascending order: bkllot234 descending order:tollkb432

Member Avatar for deceptikon
0
370
Member Avatar for fedaa91

hi i am adjusting a socket program code to make it able to read and write on files and send and recieve packets but i am stuck it only performs the first while loop and doesn't go to the next lines to execute them ! i dont usually program using …

Member Avatar for fedaa91
0
214
Member Avatar for alex910TN

Hi guys. I am a student who really needs some assistance with creating a recursive function in C that changes multiple consecutive white spaces (blanks) from an array of characters into a single blank. For instance: char c [10]; // let ␢= blank symbol where the contents are :␢␢␢␢INT␢␢␢ the …

Member Avatar for deceptikon
0
2K
Member Avatar for e.patricioparga

Ok, it's a pretty dumb title but represents well what I need to know. I'm pretty much a noob in programming and I found a problem about finding the first 3 perfect numbers. I got it solved, but I wanted to see how far I could go. My computer can …

Member Avatar for Adak
0
182
Member Avatar for anumash

Hi, I was trying to browse through the contents of an SD card containing the FAT16 filesystems using a HEX editor. I was looking up a person's program to navigate through the filesystem i.e. reading the master boot record, boot sector etc and he has used a "long" for fields …

Member Avatar for anumash
0
180
Member Avatar for blackrainbowhu

Hello! I have a problem about creating a menu, the switch statement doesn't break. Could somebody please help? The code is: do { /* ...get input... */ switch(choice) { case 1: submenu(); break; case 2: submenu2(); break; case 3: printf("\nThe program quits.\n"); exit(0); default: printf("\nNo such menu item!\n\n"); break; } …

Member Avatar for blackrainbowhu
0
216
Member Avatar for ChainedHollow

I need to multiply 2 matrices together using threads to computer each element. Ive been working on it myself but Im stuck at this point and Im getting an error. Here is the code I have. Can someone help in explaining what is wrong here or how to correct it? …

Member Avatar for WannaDoRight
0
3K
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
212
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
158
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
305
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
169
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
220
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
364
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
473
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
292
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
215
Member Avatar for harry.lloyd.7503

Hi guys/ and the minority of girls. This topic is for my teacher, who has asked me to find information of the following for himself. How can he interface a USB port to run a motor through C++? He is relatively good with computer systems himself, so why he does …

Member Avatar for MandrewP
1
256
Member Avatar for craig.durnin.1

Literally, I have been asked this question ""The Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, … ; the first two terms are 0 and 1, and each term thereafter is the sum of the two preceding terms – i.e., Fib[n] = Fib[n – 1] + Fib[n …

Member Avatar for plenty.groover
0
2K
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
213
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
437
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
166
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
254
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
280
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
324
Member Avatar for pwolf

I'm new to c# programming, and I am a little stuck on how to make a variable available across multiple forms. I read that i should make a public static class, however, my code is as follows: private void btnLogin_Click(object sender, EventArgs e) { accountNo = txtBoxAccntNo.Text; valid = validate(); …

Member Avatar for ddanbe
0
346
Member Avatar for firebird102085

Hello All, First - I am just a beginner at this (just started studying C++ this semester) so I am lost somewhat sometimes and I think I am making good headway with my first array, but, I can not get it to return any output in my console window. I'm …

Member Avatar for mrnutty
0
1K
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
244
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
249
Member Avatar for chocolatte.lavista

hello guys ! I need some help.. "assume that the process happen in some restaurant. there are seat1 until seat10 in the restaurant. the customer(user) need to enter the seat number to select the seat that they want. the seat that have been selected by customer will remark by 'reserved' …

Member Avatar for tinstaafl
0
283
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
272
Member Avatar for craig.durnin.1

Hi there guys. Literally I have been asked this question; "The Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, … ; the first two terms are 0 and 1, and each term thereafter is the sum of the two preceding terms – i.e., Fib[n] = Fib[n – …

Member Avatar for craig.durnin.1
0
7K
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
311
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
928
Member Avatar for handsomelaw

write a program which display a restaurant menu, then ask the user to select a choice from the menu. Using the switch statement select the user choice. printout the choice the user slected and the bill amount.Include in the bill a 16.5% tip and 8.25% sales tax.

Member Avatar for rubberman
0
114
Member Avatar for desolatebeast

Hey everyone need help on a project im doing in c++, so far I have made a command interpreter, that breaks user input into array of Strings sepperated by spaces and have a run function. Now I am trying to do the list() and list(directory) but I'm not quite sure …

Member Avatar for desolatebeast
0
396
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
267
Member Avatar for adfsandfianfosdaafs

Hello, i just started to study c++ and i have a problem about 1 porgram in the homework ! it ask me to write a c++ program that first asks the user if he want to enter a number if yes he enters the number and then ask him again …

Member Avatar for deceptikon
0
104
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
431
Member Avatar for kozer

Please can someone help me and send me in the right direction. I am making a program that reads a text file and then out puts the data into a datagrid, the text file looks like this: [HRData] 84 73 0 -124 0 50 84 73 0 -124 0 50 …

Member Avatar for Ketsuekiame
0
858
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
259
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
559
Member Avatar for MrProgammer

in using turbo c++ IDE i got this error in void main() #include<conio.h> #include<stdio.h> #include<math.h> void main(){ input_data1( ); }int input_data1(void) { int input; printf("\n\n**************CPU Scheduling*************\n"); printf("|\tChoose CPU Scheduling:\t\t|\n|\t1. Shortest Job Next\t\t|\n|\t2. First Come First Serve\t|\n|\t3. Round Robin\t\t\t|\n|\t4. All CPU Scheduling.\t\t|\n*****************************************\n"); scanf("%d",&input); return input; } void display() { input_data1(); }

Member Avatar for MrProgammer
0
144
Member Avatar for Xheis

Hi, I have this code in C for Flex/Lex, the only problem is that as I try to compile it it shows some errors and I dont know how to fix them. letter [a-zA-Z] digit[0-9] %% {digit}+("E"("+"|"-")?{digit}+)? printf("\n%s\tis real number",yytext); {digit}+"."{digit}+("E"("+"|"-")?{digit}+)? printf("\n%s\t is floating pt no ",yytext); "if"|"else"|"int"|"char"|"scanf"|"printf"|"switch"|"return"|"struct"|"do"|"while"|"void"|"for"|"float" printf("\n%s\t is …

Member Avatar for Tumlee
0
882

The End.