Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips

Input - Page 2

21-40 of 164     Previous     Next
Generating a Unique Filename
by Danny Kalev
To generate a unique filename that won't conflict with any other files that exist in the current directory, use the tmpnam() function declared in <stdio.h> as ...
Creating a Temporary File
by Danny Kalev
Many applications create temporary files that exist as long as the program is running and are later discarded. For example, a Web browser can store a list of pages that have been viewed during the ...
Reading Strings that Contain White Spaces
by Danny Kalev
The std::getline() functions reads data from an input stream and writes it to a string object. Unlike cin's >> operator, getline() also reads white spaces, which makes it useful for reading strings ...
Reading a String from a File
by Danny Kalev
<fstream> classes overload the operators >> for reading from a file and << for writing to it. There are several overloaded versions for each operator, one for each built-in type. In ...
Mini Database Strategy
by DevX Pro
I have recently written a small dialog based MFC app to carry out a few performance calculations for our product. I have managed to get o/p to the printer and that's OK. What I want to do now is to enable the saving of the data from the calculation in some mini database to be reviewed at a later stage—either through an interface which I will add to the program or through an existing app (notepad/excel or whatever). How should I approach this? Do I create a structure of the data I want to save and serialize it onto one long file on disk? Do I create a class that can serialize itself? I'll try and figure out the details by myself (I hope) but I am just not sure what the general solution should be.
Checking the State of a Stream
by Danny Kalev
The iostream family of classes provides the following member functions and operators for checking the stream's ...
How to Speed Up Data Transfer Between Servlet and Applet
by Mahesh Chulet
We can speed up the data transfer between servlet and applet in a Web ...
Escape Sequences
by Danny Kalev
Certain special characters are represented as escape sequences. An escape sequence begins with a \ (backslash) followed by an alphanumeric character. For example, the \n escape sequence represents ...
Writing to File from Several Functions.
by DevX Pro
The code below creates a file, Basket.doc, in the current directory. I am using a compiler with a component I would like to place in fWrite() to let me vary the entire path and file name (i.e. outName). The trouble is I want outSide to be valid from fFinish(), too. Do I need a global variable or a pointer of some kind? char outName[] = "Basket.doc"; ofstream outSide(outName); void fWrite() { outSide
Copying Files with File Streams
by Danny Kalev
To copy the contents of one file into another, use the fstream classes. First, open the source file using an ifstream object, then create a target file using ofstream, and finally, read the source ...
Rewinding a File
by Danny Kalev
Instead of using the following form to rewind a ...
Repositioning a File Pointer
by Danny Kalev
The fseek() function provides random file access. It's declared in <stdio.h> as ...
Getting the Current File Position
by Danny Kalev
The standard function ftell() reports the current file pointer position. The file pointer is a numeric value that represents the current position in the file in the form of offset in bytes from the ...
Exporting Informix
by DevX Pro
I need to migrate Informix data to an Oracle database. The current application front end imports with CSV files. Can Informix export to a CSV file?
Case Sensitivity
by DevX Pro
Is Java platform-dependent where the case sensitivity of filenames is concerned? In Unix, filenames are case sensitive whereas in Windows they are not. How does it work when Java is reading filenames from a directory structure?
File Deletion
by DevX Pro
I'm opening a file for reading, and after reading its contents I write it all to other file. Now I want to delete the original file. How do I this?
Unbuffered Streams
by Danny Kalev
The standard stream object cerr and its matching wide-character version, wcerr, are unbuffered. This means that they are automatically flushed after each operation; they do not buffer data. This ...
Use a String Object to Read Input Safely
by Danny Kalev
One of the common sources for bugs and security risks is using a fixed size char array as a buffer for inputting data. For ...
Deleting a File
by Danny Kalev
The standard function remove() deletes a file. It takes one argument of type const char * which is the name of the file to be deleted. You can provide a full path as a filename. On success, remove() ...
Renaming a File
by Danny Kalev
To rename a file, use the standard function rename() (declared in <stdio.h>). This function takes two arguments of type const char *, the first of which is the old name and the second one is the ...
21-40 of 164     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date