You shot yourself in the foot right at the start. You can't return a pointer to memory on the stack and expect it to be valid when it goes out of scope.
Dear friends
I have a bit basic doubts in pointers and the structures inter relationships.
the first one.
static struct apvt {
int dead;
int pending;
int abouttograb;
}*agents=NULL;
what agents pointer is... (1 Reply)
Hi All,
I was given a format of a file, and was asked to write a program which displays the data contained in the file in that purticular format.
Its all so confusing.
Please find the example of the format as well the code I have written in the attachment.
I hope any one of u guyz can... (0 Replies)
Hi all!
I am working on unix systems.I am programming in c.
I have got some problems with pthread.when I use pthread_create to creat a thread it says:
(.text+0x3a): undefined reference to `pthread_create'.
same is the problm with pthread_kill.
Can anyone help me out here.
Thanks.
vij. (2 Replies)
hello
can any1 plz tell me about the system defined structures (like sysinfo) which wil give system and n/w charecteristics (ex: freeram in sysinfo). (1 Reply)
Hello,
I run my pthread code on Linux with 4 processors. However, the speed up is only 2 times.
The code is about solving equation (G+s(i)C)z(i)=B*us(i), i=1,...,n. Here G,C are m*m matrix, B*us(i) is a m*1 vector and s(i) are n different numbers. I need to solve the equation n times to... (2 Replies)
Hi All,
I am using the array of pointers and storing the address of string.This is a global list.
So i am using extern to give the reference of this list to another file and using reading the data from this string.
But list is being corrupted and string is missing some characters in... (2 Replies)
Hi all,
I wrote some code in c, using pthread (I configured the linker and compiler in eclipse IDE first).
#include <pthread.h>
#include "starter.h"
#include "UI.h"
Page* MM;
Page* Disk;
PCB* all_pcb_array;
void* display_prompt(void *id){
printf("Hello111\n");
return... (1 Reply)
Hello All,
I am having this issue...where I am actually having hard time understanding the problem:
The code is as follows:
#include<iostream.h>
void fxn(char*** var)
{
int i =4;
*var = (char**)malloc(i*sizeof(char*));
for(int j =0; j<4; j++)
{
*var = "name";
cout<<*var;... (6 Replies)
Hello,
I have a signal handler which manipulates a data structure. The data structure's operations aren't atomic. So if two threads/processes are in a critical section at the same time the data structure will be broken.
With threads you can avoid this stuff with semaphores etc.
However,... (10 Replies)
Discussion started by: littlegnome
10 Replies
LEARN ABOUT MOJAVE
_llseek
LLSEEK(2) Linux Programmer's Manual LLSEEK(2)NAME
_llseek - reposition read/write file offset
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int _llseek(unsigned int fd, unsigned long offset_high,
unsigned long offset_low, loff_t *result,
unsigned int whence);
Note: There is no glibc wrapper for this system call; see NOTES.
DESCRIPTION
The _llseek() system call repositions the offset of the open file description associated with the file descriptor fd to (offset_high<<32) |
offset_low bytes relative to the beginning of the file, the current file offset, or the end of the file, depending on whether whence is
SEEK_SET, SEEK_CUR, or SEEK_END, respectively. It returns the resulting file position in the argument result.
This system call exists on various 32-bit platforms to support seeking to large file offsets.
RETURN VALUE
Upon successful completion, _llseek() returns 0. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
EBADF fd is not an open file descriptor.
EFAULT Problem with copying results to user space.
EINVAL whence is invalid.
CONFORMING TO
This function is Linux-specific, and should not be used in programs intended to be portable.
NOTES
Glibc does not provide a wrapper for this system call. To invoke it directly, use syscall(2). However, you probably want to use the
lseek(2) wrapper function instead.
SEE ALSO lseek(2), open(2), lseek64(3)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 LLSEEK(2)