Max size of char* [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
Using C, how do we find the max size of char* allowed by a file system?

My assumption here is that you are asking for "What is the maximum allowable length of a file name allowed by a file system?"
This is dependent on the OS and how the filesystem is implemented, but most systems have defined macros that can be referenced.
In Linux, limits.h, the value can be reference by the macro PATH_MAX, 4096 (Current as of kernel 2.6.35)
In Windows, WinDef.h, the value can be reference by the macro MAX_PATH, 260 (Current as of Windows 7). This does not include the use of UNC paths (See comment below).

Related

how to check out wordsize on linux [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
As we can see a macro defined in stdint.h or bits/types.h etc.. which is __WORDSIZE. I don't know where to check out whether this macro is defined. Also, is there a way to checkout different size of the basic types without using the sizeof in c. I mean, is there a document exhibits the size of those variables?
Well, it depends on the platform. First, there are some requirements set by the C standard and/or the POSIX standard if you use UNIX. Things like sizeof(int) <= sizeof(long) or sizeof(char) == 1
Then the ABI has the final say. For example, on linux/freebsd/solaris on x86_64, they use a common ABI: http://people.freebsd.org/~obrien/amd64-elf-abi.pdf
3.1.2 in this document has the size for all types for this ABI

How to Lock a file and avoid readings while it's writing in C programing [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to lock a file while writing no one should be able to read it. how to do it?.. please provide sample code.
Do you use fopen? Then
fopen
x -
Open the file exclusively (like the O_EXCL flag of open(2)). If the file already exists, fopen() fails, and sets errno to EEXIST. This flag is ignored for fdopen().

Get Size Of File From Commandline Input In C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to get the size of a file from the commandline in C using argv. I'm not too familiar with file i/o in C, so any pointers would be greatly appreciated. Thanks.
You've not stated the platform, but your C program is given an argument list when it is started, and the file names are strings. The POSIX function you'd probably use is stat(); it takes a pointer to a struct stat and will put the file's size into the st_size member of the structure.
The answer may be different on Windows; the POSIX subsystem will provide a stat() workalike (probably named _stat()), but there'll also be a native interface.

How to read an image file from hard to memory using C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to read an image(JPEG) file from hard disk to memory. How can I do this? What kind of variable type should I use ?
Use a big char array
char data[4096]
And fread(3) chunks into it. Of course an entire JPEG won't fit in 4096 bytes, but perhaps you can work with chunks instead of the entire file ?

Where the offset in a file is stored in C? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
In which place C saves file's offset?
When using standard C I/O, a FILE pointer contains most of the information needed to deal with the file, including its "position indicator." As you read or write through the file, its position (seek) indicator gets updated. See the definition of the FILE type.

Resources