Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo,

also, ich lern grad n bissl Java.

Jetzt versuch ich was in eine Datei zu speichern

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class WriteFile {

public void save(String content, String filename){

if (filename != null){

File f = new File(filename);
try {
FileWriter writer = new FileWriter(f);
BufferedWriter output = new BufferedWriter(writer);

output.write(content);

output.close();
writer.close();
}
catch (IOException e){
System.out.print("Schreibfehler "+e);
}
}
}
}
[/PHP]

effekt in der Datei sieht wie folgt aus :/

[code]Dies ist ein Text in einer Zeile Zweite Zeile Dritte Zeile Ende[/code]

Hat irgendwer hier ne Ahnung, wie das zustandekommt?

ehmja...lol hat sich erledigt^^

Der Notepad kriegt's nur irgendwie net auf die reihe...weiss irgendwer von euch, warum :confused:

Weil für Windows eine neue Zeile nur die Verbindung von "\r\n" ist. Das heißt wenn du nur "\n" schreibst sieht dass der Notepad nicht als neue Zeile, sondern nur als Sonderzeichen an. Was er dann als schwarzes Kästchen anzeigt, weil es für ihn ansonsten nicht darstelltbar ist.

WordPad uä kriegt das aber problemlos hin...

Die Kommandozeile auch...

...und in C++ klappt das so doch auch...oder seh ich jetz was falsch?

das ist eben für die notepad.exe spezifisch, dass nur \n korrekt verarbeitet wird und \r\n nicht.

s'Amstel

Eher so, oder? ;)

urks, ja. danke ;)

s'Amstel

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.