- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
18 Posted Topics
it might be because you havent defined pid of type pid_t. you need to do the following in order to be able to use pid: [code] #include<sys/types.h> pid_t pid1; pid1=fork(); [/code] you can then use wait(pid). [QUOTE=rwagnes;334208]I am supposed to create a chain of N processes, where N is the …
I know how to use the file_pointer=fopen("location","type") to open and check if a file exists. But I'm not sure how I would use this command or a similar one to check if a folder exists? What command do I have to use to check if a folder exists in the …
We've made a form and when the user fills out the form and clicks "send" we want to do the following: 1) Get the data 2) Run a python script which displays the factorial of 10 [code] <!test get form> <html> <head> <center> TEST </center> </head> <body> <form name="input" action="./fact.py" …
Hey, I needed to delete a file created by a child process and our prof suggested that I use the system() command to do so. I 'manned' system but cant find anything useful on how to use it to delete an opened file. Can anyone suggest as to how this …
As part of my program, I have defined and initialized a structure. But when I compile it, gcc gives me the following error on all the initialization " initializer element is not constant". Anyone know why this is the case? [code] struct RECORD { char* username; char* password; char* type; …
I need to edit every character of a string for an assignment; apply a simple Caesar cipher on it. What is the C equivalent of "charAt()"? I remember my prof saying that all strings are terminated with a certain character in C and that you could run a while loop …
How do you add a character to an existing string? In java you could just do: char c='a'; String b="posit"; b+=c; but I tried doing that in C and it doesnt work. Is there a workaround? Thanks.
I need to read data from a flat file [find below] into a linked list. Each line is a record and each record needs to be read into a different node. After I open the file using fopen(), I have the following problem: 1) How do I move from the …
[QUOTE=dmm;1041993]can I open a file and then close it in a loop? I tried but it doesnt seem to work. :([/QUOTE] No, I dont think C/C++ allow you to use fopen/fclose in a loop. If you use Linux, try "man-ing" fopen for more info: man 3 fopen hope this helps.
Hey, How do I create a file from a C program? I want to check if the file exists and if it doesnt, then create it. I am using the following code to check if it exists: [code] filecheck() { b=fopen("password.csv","r+w"); if(b==NULL) { // need code for creating a file …
Hey, How do you read from the command line in C? I need to read 10 arguments from the command line. Can I use char* argv[] as a parameter in the main function to do so? Thanks.
Searching a linked list linearly is very inefficient. Is it possible to use binary search on linked lists?
How do you exactly go about writing an algorithm to check for tree isomorphism?
Hey, How do you prove that log (n!) is big theta of n log n? I tried using the definition method and the shortcut rules but I keep getting stuck.
Hey, so I need to write an algorithm that will do the following and run in O(n): Search linearly through an array of size n and for each element check whether array[i]>array[i-k] for all k=1,2,...n/5. Its easy to do this with two loops but I cant figure out how to …
Hey, How do you go about proving that log(n!) is big Theta of n log n?
So I have to read data from a text file into a [50][50] array and Im not really sure which commands I can use to do that and to write back some data into another file. Would really appreciate some help on this.
I was wondering if there was a way to control the cursor on Linux and use a C/C++ program to make a certain 'output' appear on the screen in any co-ordinate we want for a specific period of time?
The End.
shakunni