Hi,
I am trying to write to a .txt file an integer
but the characters I see when I open the file are strange.

Could you tell me what happens ??

[CODE]
import java.io.*;

public class A
{
public static int readInt()
{

   byte b[] = new byte[16]; 
   String str;
   try {
       System.in.read(b);
       str = (new String(b)).trim();
       return Integer.parseInt(str);
    } catch (IOException e) {
        System.out.println("Exception: " + e.toString());
        return 0;
    } catch (NumberFormatException e) {
        System.out.println("Exception: " + e.toString() + "\nReturned value: -1");
        return -1;
    }

}

public static void main(String[] args)
{
    System.out.println("Press Int:");
    int i = readInt();

    try {
        FileOutputStream f = new FileOutputStream("test.txt");
        BufferedOutputStream b = new BufferedOutputStream(f);
        DataOutputStream d = new DataOutputStream(b);

        d.writeInt(i);

        d.close();

} catch (FileNotFoundException e) {}
catch (IOException e) {}
}
}
[/CODE]

Hi,
I want to make a program that reads a string.
But I would like to read only characters, neither numbers nor special characters(@,#$%^&*()!). Also, no spaces between characters.

[CODE]

include <stdio.h>

include <string.h>

char *enter_a_string(int maxcharacters)
{

char *ptr;
int len;

printf("Enter string : ");
char array[50];

do{
    scanf("%s",array);
    len = strlen(array);

    if(len > maxcharacters)
    {
        printf("Maximum %d  characters. Try again : ",maxcharacters);
    }

}while(len > maxcharacters);

ptr = array;

return ptr;
}

int main()
{
char array[50];
strcpy(array,get_personal_elements(15));
}[/CODE]

Could someone help me please?
Thanks a lot

Hi,
I use a upload form to upload images first in a server directory and then I would like to save file in a database.

My questions :

  1. I would like to change the name that image is saved like that :
    Image_1.jpeg or Image_1.gif whatever type.

  2. I need to save in a database table

table images{
id
name_image
type_image
size
}

Could someone help me ???

Please