How can I find the modification date and time of a file?
How can I find the modification date and time of a file? The Unix and POSIX function is stat, which several other systems supply as well. 2015-04-13, 970👍, 0💬
How can I insert or delete a line (or record) in the middle of a file?
How can I insert or delete a line (or record) in the middle of a file? In general, there is no way to do this. The usual solution is simply to rewrite the file. When you find yourself needing to insert data into an existing file, here are a few alternatives you can try: * Rearrange the data file so ... 2015-04-13, 928👍, 0💬
How can I recover the file name given an open stream or file descriptor?
How can I recover the file name given an open stream or file descriptor? This problem is, in general, insoluble. Under Unix, for instance, a scan of the entire disk (perhaps involving special permissions) would theoretically be required, and would fail if the descriptor were connected to a pipe or r... 2015-04-10, 1023👍, 0💬
How can I delete a file?
How can I delete a file? The Standard C Library function is remove. (This is therefore one of the few questions in this section for which the answer is not ``It's system-dependent.'') On older, pre-ANSI Unix systems, remove may not exist, in which case you can try unlink. 2015-04-10, 900👍, 0💬
How do I copy files?
How do I copy files? Either use system() to invoke your operating system's copy utility, or open the source and destination files (using fopen or some lower-level file-opening system call), read characters or blocks of characters from the source file, and write them to the destination file. Here is ... 2015-04-08, 1002👍, 0💬
Why cant I open a file by its explicit path?
Why can't I open a file by its explicit path? The call fopen("c:\newdir\file.dat", "r") is failing. The file you actually requested--with the characters \n and \f in its name--probably doesn't exist, and isn't what you thought you were trying to open. In character constants and string literals, the ... 2015-04-08, 978👍, 0💬
fopen isnt letting me open files like "$HOME/.profile" and "~/.myrcfile".
fopen isn't letting me open files like "$HOME/.profile" and "~/.myrcfile". Under Unix, at least, environment variables like $HOME, along with the home-directory notation involving the ~ character, are expanded by the shell, and there's no mechanism to perform these expansions automatically when you ... 2015-04-06, 1061👍, 0💬
How can I suppress the dreaded MS-DOS Abort, Retry, Ignore? message?
How can I suppress the dreaded MS-DOS Abort, Retry, Ignore? message? Among other things, you need to intercept the DOS Critical Error Interrupt, interrupt 24H. See the comp.os.msdos.programmer 2015-04-06, 1001👍, 0💬
How can I increase the allowable number of simultaneously open files?
I'm getting an error, ``Too many open files''. How can I increase the allowable number of simultaneously open files? A: There are typically at least two resource limitations on the number of simultaneously open files: the number of low-level ``file descriptors'' or ``file handles'' available in the ... 2015-04-03, 1026👍, 0💬
How can I find out how much free space is available on disk?
How can I find out how much free space is available on disk? There is no portable way. Under some versions of Unix you can call statfs. Under MS-DOS, use interrupt 0x21 subfunction 0x36, or perhaps a routine such as diskfree. Another possibility is to use popen to invoke and read the output of a ``d... 2015-04-03, 931👍, 0💬
How can I read a directory in a C program?
How can I read a directory in a C program? See if you can use the opendir and readdir functions, which are part of the POSIX standard and are available on most Unix variants. Implementations also exist for MS-DOS, VMS, and other systems. (MS-DOS also has FINDFIRST and FINDNEXT routines which do esse... 2015-04-01, 1022👍, 0💬
How do I create a directory? How do I remove a directory (and its contents)?
How do I create a directory? How do I remove a directory (and its contents)? If your operating system supports these services, they are likely to be provided in C via functions named mkdir and rmdir. Removing a directory's contents as well will require listing them and calling remove . If you don't ... 2015-04-01, 975👍, 0💬
How can I find out how much memory is available?
How can I find out how much memory is available? Your operating system may provide a routine which returns this information, but it's quite system-dependent. (Also, the number may vary over time.) If you're trying to predict whether you'll be able to allocate a certain amount of memory, just try it-... 2015-03-30, 1040👍, 0💬
How can I allocate arrays or structures bigger than 64K?
How can I allocate arrays or structures bigger than 64K? A reasonable computer ought to give you transparent access to all available memory. If you're not so lucky, you'll either have to rethink your program's use of memory, or use various system-specific techniques. 64K is (still) a pretty big chun... 2015-03-30, 996👍, 0💬
I thought that using large model meant that I could use more than 64K of data!
What does the error message ``DGROUP data allocation exceeds 64K'' mean, and what can I do about it? I thought that using large model meant that I could use more than 64K of data! Even in large memory models, MS-DOS compilers apparently toss certain data (strings, some initialized global or static v... 2015-03-20, 962👍, 0💬
How can I do PEEK and POKE in C?
How can I access memory (a memory-mapped device, or graphics memory) located at a certain address? How can I do PEEK and POKE in C? Set a pointer, of the appropriate type, to the right number (using an explicit cast to assure the compiler that you really do intend this nonportable conversion): unsig... 2015-03-20, 999👍, 0💬
How can I invoke another program (a standalone executable, or an operating system command) from within a C program?
How can I invoke another program (a standalone executable, or an operating system command) from within a C program? Use the library function system, which does exactly that. Some systems also provide a family of spawn routines which accomplish approximately the same thing. system is more ``portable'... 2015-03-18, 1027👍, 0💬
How can I call system when parameters (filenames, etc.) of the executed command arent known until run time?
How can I call system when parameters (filenames, etc.) of the executed command arent known until run time? Just use sprintf (or perhaps strcpy and strcat) to build the command string in a buffer, then call system with that buffer. (Make sure the buffer is allocated with enough space; Here is a cont... 2015-03-18, 1038👍, 0💬
How do I get an accurate error status return from system on MS-DOS?
How do I get an accurate error status return from system on MS-DOS? You can't; COMMAND.COM doesn't tend to provide one. If you don't need COMMAND.COM's services (i.e. if you're just trying to invoke a simple program, without I/O redirection and such) try one of the spawn routines, instead. 2015-03-16, 1035👍, 0💬
How can I invoke another program or command and trap its output?
How can I invoke another program or command and trap its output? Unix and some other systems provide a popen function, which sets up a stdio stream on a pipe connected to the process running a command, so that the calling program can read the output (or alternatively supply the input). Using popen, ... 2015-03-16, 1027👍, 0💬
How can my program discover the complete pathname to the executable from which it was invoked?
How can my program discover the complete pathname to the executable from which it was invoked? argv may contain all or part of the pathname, or it may contain nothing. You may be able to duplicate the command language interpreter's search path logic to locate the executable if the name in argv... 2015-03-13, 1010👍, 0💬
How can I automatically locate a programs configuration files in the same directory as the executable?
How can I automatically locate a programs configuration files in the same directory as the executable? It's hard, in general; Even if you can figure out a workable way to do it, you might want to consider making the program's auxiliary (library) directory configurable, perhaps with an environment va... 2015-03-13, 1011👍, 0💬
How can a process change an environment variable in its caller?
How can a process change an environment variable in its caller? It may or may not be possible to do so at all. Different operating systems implement global name/value functionality similar to the Unix environment in different ways. Whether the ``environment'' can be usefully altered by a running pro... 2015-03-11, 985👍, 0💬
How can I open files mentioned on the command line, and parse option flags?
How can I open files mentioned on the command line, and parse option flags? Here is a skeleton which implements a traditional Unix-style argv parse, handling option flags beginning with -, and optional filenames. (The two flags accepted by this example are -a and -b; -b takes an argument.) #include ... 2015-03-11, 1093👍, 0💬
.NET INTERVIEW QUESTIONS - How can you avoid deadlock in threading? A good and careful planning can ...
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want ...
What is a measure in OLAP ? Measures are the key performance indicator that you want to evaluate. To...
Describe in detail Basic of SAO architecture of Remoting? For these types of questions interviewer e...
How can we suppress a finalize method? GC.SuppressFinalize ()