This is part of an assignment so please dont post solutions, just point me in the right direction if possible?
I am passing a pointer to a char array to my method, as well as a value for the actual height of the char array. I am looping through to see if all values are 0, if they are then return 0, esle return one
The method is used as...
Hi,
I'm doing a project on filesystems on a university operating systems course, my C program should simulate a simple filesystem in a human-readable file, so the file should be based on lines, a line will be a "sector". I've learned, that lines must be of the same length to be overwritten, so I'll pad them with ascii zeroes till the en...
Hi, I'm writing a client-server app, in which the client has a determined memory address from the server side.
If something goes wrong and the server needs to be reestarted the address the client has is not valid anymore. When using a function using that invalid info a SIGSEGV will be sent to the server as the address may not be its any...
How does objdump manage to display source code? Is there a reference to the source file in the binary? I tried running strings on the binary and couldn't find any reference to the source file listed...
Thanks.
...
I have a project written in C and I would like to know if there is a simple way to profile its execution time and memory usage under Windows.
Thanks in advance.
...
I'm trying to create a simple Java app that uses JNI to call some native functions. I've followed the examples in the JNI Programming Guide and can't seem to get them to work. I have the following Hello World program, written in Java:
class HelloWorld {
private native void print();
public static void main(String [] args) {
...
I've all this kind of functions.
ssize_t fuc1(int var1, void *buf, size_t count);
int func2(char *charPtr, int mode, int dev);
short func3( long var2);
problem is that data types in C has different sizes when compiled on different machines(64bit & 32bit). This is true for even void*. For some reasons. I need to ensure that these siz...
For example, strlen() takes about 3*O(n). Why 3? I've wrote a really simple strlen-like function - it works much faster.
int string_len(char s[],int &l)
{
for(l=0;s[l];l++);
return l;
}
Well, some of my friends says, nearly all of string.h algorithms are slower than they should be.
...
I have an enum declaration as:
enum qty { cars = 10, bikes = 9, horses = 9 ... } // total 28
How could I add up all the associated values of enumerator-list?
...
Hi,
Is there an alternative in OpenSSL to SSL_set_connect_state()/SSL_set_accept_state() for X.509 certificate based authentication?
The problem is that in my application the client and server do not communicate using sockets, and the establishment of direct connection between them is not possible. So what I want from OpenSSL is to 'e...
Hey all, the following is a snippet of code taken from the unix ptx utility. I'm attempting to maximize code coverage on this utility, but I am unable to reach the indicated portion of code. Admittedly, I'm not as strong in my C skills as I used to be. The portion of code is indicated with comments, but it is towards the bottom of the bl...
I have the following code:
printf("num: %d\n", strcasecmp(buf, "h\n"));
And I get the following results when I try plugging in different letters:
a: -7
g: -1
i: 1
j: 2
h: 156
H: 156
Should strcasecmp not return 0 when buf is equal to H or h? Any ideas why it's returning 156? I need to figure out how to check whether the user types ...
Hi all is the memory allocated for different types of variable say float, int and char is different for different architecture?
Thanks in advance.
...
Hi,
i was just checking the behaviour of fork system call and i found it very confusing.
i saw in a website that
Unix will make an exact copy of the parent's address space and give it to the child. Therefore, the parent and child processes have separate address spaces
#include <stdio.h>
#include <sys/types.h>
int main(void)
{
pid_t ...
is it possible to develop a GUI in linux c??
how can be do that??
...
I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver.
Can you pl...
How to disable ctrl+alt+del using c in window OS. I have use
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, true, &bOldState, 0);
but it doesn't working for me, kindly guide me, so that i can make it possible.
...
I am using CreateProcess function for creating the process, is there any option to get the current state of the process (running or not). Kindly guide me how can I make it possible.
...
This program is intended to read a .txt file to get a set of numbers, and write to another two .txt files called even and odd as follows:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int i=0,even,odd;
int number[i];
// check to make sure that all the file names are entered
if (argc != 3) {
prin...
Hi,
I'm a bit new to C's malloc function, but from what I know it should store the value in the heap, so you can reference it with a pointer from outside the original scope. I created a test program that is supposed to do this but I keep getting the value 0, after running the program. What am I doing wrong?
int f1(int * b) {
b = mal...