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.

Benutzung von "Setlocale" für Dateiausgabe

Empfohlene Antworten

Veröffentlicht

Ich möchte, daß bei der Ausgabe von Daten in eine Datei, ein Komma statt eines Punktes geschrieben wird.

Ich habe hierzu die funktion "setlocale" eingebunden, jedoch erfolgt die Ausgabe immer noch als Punkt.

ofstream ofl1(filewrite, ios::out|ios::app);	// öffnen der Ausgabedatei
// erster Datenblock
ofl1 << setfill(' ') << setw(20) << "BlockNum."; // Blocknummer
ofl1 << setfill(' ') << setw(20) << "Anz.Werte"; // Anzahl der Werte im Block
ofl1 << setfill(' ') << setw(20) << "Zeit"; // Zeitstempel des Blockes
...
ofl1 << endl;
ofl1.close(); //Schliessen des Datenfiles

ifstream ifl(har_daten, ios::in|ios::binary); //Öffnen der Messdatendatei
do
{
for (i = 0; i < MAX_DURCHLAUF; i++)
{
double timechecka;
double timecheckb;
double timecheckc, tchecka, tcheckb;
int t = z+2;
ifl.seekg(t*sizeof(short), ios::beg);
ifl.read((char*)&timechecka, sizeof(int));
tchecka = (timechecka - TIME_CORRECTION)/86400 + 25569;
timecheckc = (zeit - TIME_CORRECTION)/86400 + 25569;
tcheckb = timecheckc-1;
bool timecheck(tcheckb <= tchecka && tchecka <= timecheckc);
switch (timecheck)
{
case 1: z = z + 72; timeerror++; break;
case 0:
ifl.seekg(z*sizeof(short), ios::beg);
ifl.read((char*)&block2, sizeof(short));
switch(block2)
{
case 2: //kein Fehler - erster Datenblock (Blocknummer 2)
ifl.seekg(z*sizeof(short), ios::beg);
//Zuweisung Blocknummer
ifl.read((char*)&daten[i].block_num_1, sizeof(short));
z++;
ifl.seekg(z*sizeof(short), ios::beg);
//Zuweisung Blocklänge (Anzahl der Werte)
ifl.read((char*)&daten[i].length_block_1, sizeof(short));
z++;
ifl.seekg(z*sizeof(short), ios::beg);
//Zuweisung Zeitstempel
ifl.read((char*)&daten[i].zeit_stempel_1, sizeof(int));
z++;
z++;
.....
break;
} //switch
}
setlocale (LC_AA, "");
ofstream ofl3(filewrite, ios::out|ios::app); // öffnen der Ausgabedatei
ofl3.setf(ios::fixed);
// schreiben des Datenfiles
// Block 1
ofl3 << setfill(' ') << setw(20) << daten[i].block_num_1; // Blocknummer
ofl3 << setfill(' ') << setw(20) << daten[i].length_block_1;// Anzahl der Werte im Block
ofl3 << setfill(' ') << setw(20) << setprecision(5) << Timestampa; // Zeitstempel des Blockes
.....[/PHP]

Muss es an eine andere Stelle, oder geht das so gar nicht?

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.