Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
changing while loops to for loops

I'm trying to change this while loop into a for loop and I'm not getting particularly far. I am new ish to programming, so apologies if this is a trivial task.

while (read < fileBytes.length
       && (numRead = diStream.read(fileBytes, read, fileBytes.length - read)) >= 0)
{
    read = read + numRead;
}
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Try to use this :

start_value = //....
for (read = start_value; read < fileBytes.length 
        && (numRead = diStream.read(fileBytes, read, fileBytes.length - read)) >= 0; 
        read += numRead) {

    //Your actions

}
over 4 years ago · Santiago Trujillo Denunciar

0

I'm a C# Programmer, but I will write code which is very similar to what you need.

for (int read = 0; read < fileBytes.length;) {
    numRead = diStream.read(fileBytes, read, fileBytes.length - read);
    if (numRead >= 0) {
        read = read + numRead;
    }
}
over 4 years ago · Santiago Trujillo Denunciar

0

for(numRead = diStream.read(fileBytes, read, fileBytes.length - read);
read < fileBytes.length && numRead >= 0;
numRead = diStream.read(fileBytes, read, fileBytes.length - read)) {
      read = read + numRead;
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda